1.0.0 release
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
// ProjectRunnerTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
import Foundation
|
||||
@testable import LyrebirdCLI
|
||||
|
||||
@Suite("ProjectRunner")
|
||||
struct ProjectRunnerTests {
|
||||
|
||||
// MARK: - findSwift
|
||||
|
||||
@Test func findSwiftReturnsPath() throws {
|
||||
// On macOS with Xcode installed, /usr/bin/swift should always exist.
|
||||
// If this test is running, swift is present (we're running in a Swift test binary).
|
||||
let swiftPath: String = try ProjectRunner.findSwift()
|
||||
#expect(swiftPath.contains("swift"))
|
||||
#expect(FileManager.default.isExecutableFile(atPath: swiftPath))
|
||||
}
|
||||
|
||||
// MARK: - makeProcess configuration
|
||||
|
||||
@Test func makeProcessDebugUsesRunArgument() throws {
|
||||
let process: Process = try ProjectRunner.makeProcess(release: false)
|
||||
#expect(process.arguments == ["run"])
|
||||
}
|
||||
|
||||
@Test func makeProcessReleaseAddsFlag() throws {
|
||||
let process: Process = try ProjectRunner.makeProcess(release: true)
|
||||
#expect(process.arguments == ["run", "-c", "release"])
|
||||
}
|
||||
|
||||
@Test func makeProcessUsesCurrentDirectory() throws {
|
||||
let cwd: String = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
|
||||
.resolvingSymlinksInPath().path
|
||||
let process: Process = try ProjectRunner.makeProcess(release: false)
|
||||
let processDir: String? = process.currentDirectoryURL?.resolvingSymlinksInPath().path
|
||||
#expect(processDir == cwd)
|
||||
}
|
||||
|
||||
@Test func makeProcessUsesSuppliedDirectory() throws {
|
||||
let tmp: String = FileManager.default.temporaryDirectory.path
|
||||
let process: Process = try ProjectRunner.makeProcess(release: false, in: tmp)
|
||||
// currentDirectoryURL may resolve symlinks; just check the tail
|
||||
#expect(process.currentDirectoryURL != nil)
|
||||
}
|
||||
|
||||
@Test func makeProcessExecutableIsSwift() throws {
|
||||
let process: Process = try ProjectRunner.makeProcess(release: false)
|
||||
let exePath: String = process.executableURL?.path ?? ""
|
||||
#expect(exePath.contains("swift"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user