Files
Lyrebird/LiveCompile/Tests/LyrebirdLiveCompileTests/ToolchainProbeTests.swift
T
josh b6fdee8bfc Lyrebird 2.0.0 — Linux support
Consolidated release: the cross-platform Linux port (engine, generators, CLI,
REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable
WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux
live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive.
See RELEASES.md and LINUX_README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-10 21:09:11 -07:00

55 lines
2.0 KiB
Swift

// ToolchainProbeTests.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if os(macOS) || os(Linux)
import Testing
@testable import LyrebirdLiveCompile
@Suite("ToolchainProbe")
struct ToolchainProbeTests {
private func probe(swiftc: String?, sdk: String?, devDir: String?) -> ToolchainProbe {
ToolchainProbe(
swiftcResolver: { swiftc },
sdkResolver: { sdk },
developerDirResolver: { devDir }
)
}
@Test("swiftc + SDK both present → available")
func availableWhenBothResolve() {
#expect(probe(swiftc: "/usr/bin/swiftc", sdk: "/SDK", devDir: "/Dev").status() == .available)
}
@Test("no swiftc and no developer dir → missingDeveloperTools")
func missingDeveloperTools() {
#expect(probe(swiftc: nil, sdk: nil, devDir: nil).status() == .missingDeveloperTools)
}
@Test("no swiftc but developer dir present → missingSwiftc")
func missingSwiftc() {
#expect(probe(swiftc: nil, sdk: nil, devDir: "/Dev").status() == .missingSwiftc)
// SDK value is irrelevant when swiftc is unresolved.
#expect(probe(swiftc: nil, sdk: "/SDK", devDir: "/Dev").status() == .missingSwiftc)
}
@Test("swiftc present but SDK missing → missingSDK")
func missingSDK() {
#expect(probe(swiftc: "/usr/bin/swiftc", sdk: nil, devDir: "/Dev").status() == .missingSDK)
}
@Test("default probe on a build machine finds developer tools")
func defaultProbeFindsDeveloperTools() {
// Any machine that can build/test this package has a developer directory, so
// the real (non-injected) resolvers must never report missingDeveloperTools —
// this smoke-tests that the default xcode-select / xcrun probes actually run.
// (Not asserting strict `.available`: a full-SDK requirement would couple the
// suite to the host's exact toolchain completeness.)
#expect(ToolchainProbe().status() != .missingDeveloperTools)
}
}
#endif