Skip to content

Commit 19b3598

Browse files
committed
Fix Process tests
1 parent 6d746d9 commit 19b3598

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Tests/Foundation/TestProcess.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,7 @@ class TestProcess : XCTestCase {
413413
}
414414

415415
func test_terminate() throws {
416-
guard let process = try? Process.run(try xdgTestHelperURL(), arguments: ["--cat"]) else {
417-
XCTFail("Cant run 'cat'")
418-
return
419-
}
416+
let process = try Process.run(try xdgTestHelperURL(), arguments: ["--cat"])
420417

421418
process.terminate()
422419
process.waitUntilExit()
@@ -549,6 +546,10 @@ class TestProcess : XCTestCase {
549546

550547

551548
func test_plutil() throws {
549+
#if os(Windows)
550+
// See explanation in xdgTestHelperURL() as to why this is unsupported
551+
throw XCTSkip("Running plutil as part of unit tests is not supported on Windows")
552+
#else
552553
let task = Process()
553554

554555
guard let url = testBundle(executable: true).url(forAuxiliaryExecutable: "plutil") else {
@@ -576,6 +577,7 @@ class TestProcess : XCTestCase {
576577
}
577578
XCTAssertEqual(String(data: $0, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines), "No files specified.")
578579
}
580+
#endif
579581
}
580582

581583
@available(*, deprecated) // test of deprecated API, suppress deprecation warning
@@ -613,7 +615,7 @@ class TestProcess : XCTestCase {
613615
XCTAssertEqual(process.currentDirectoryPath, "")
614616
XCTAssertNil(process.currentDirectoryURL)
615617
process.currentDirectoryURL = nil
616-
XCTAssertEqual(process.currentDirectoryPath, cwd.path)
618+
XCTAssertEqual(process.currentDirectoryPath, cwd.withUnsafeFileSystemRepresentation { String(cString: $0!) })
617619

618620

619621
process.executableURL = URL(fileURLWithPath: "/some_file_that_doesnt_exist", isDirectory: false)

0 commit comments

Comments
 (0)