90dc00f323
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.4 KiB
Swift
41 lines
1.4 KiB
Swift
// ToolchainAlertTests.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#if os(macOS)
|
|
import Testing
|
|
import LyrebirdLiveCompile
|
|
@testable import LyrebirdLiveCompileUI
|
|
|
|
@Suite("ToolchainAlert content")
|
|
struct ToolchainAlertTests {
|
|
|
|
@Test("available status produces no alert content")
|
|
func availableIsNil() {
|
|
#expect(toolchainAlertContent(for: .available) == nil)
|
|
}
|
|
|
|
@Test("missing-toolchain statuses offer the Command Line Tools install")
|
|
func missingOffersCLTInstall() {
|
|
for status: SwiftToolchainStatus in [.missingDeveloperTools, .missingSwiftc] {
|
|
let content: ToolchainAlertContent? = toolchainAlertContent(for: status)
|
|
#expect(content != nil)
|
|
#expect(content?.offersCommandLineToolsInstall == true)
|
|
#expect(content?.title.isEmpty == false)
|
|
// Steers the user to the dependency-free fallback.
|
|
#expect(content?.message.contains("Graph DSL") == true)
|
|
}
|
|
}
|
|
|
|
@Test("missing-SDK does not offer CLT install (needs a full Xcode)")
|
|
func missingSDKNoCLT() {
|
|
let content: ToolchainAlertContent? = toolchainAlertContent(for: .missingSDK)
|
|
#expect(content != nil)
|
|
#expect(content?.offersCommandLineToolsInstall == false)
|
|
#expect(content?.message.contains("Xcode") == true)
|
|
}
|
|
}
|
|
#endif
|