Skip to content

Commit 7405bd3

Browse files
authored
Merge pull request #2684 from compnerd/alternate-roots
test: correct test assumption for Windows paths
2 parents b883eca + c054c52 commit 7405bd3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Tests/Foundation/Tests/TestProcess.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,16 @@ class TestProcess : XCTestCase {
634634

635635
do {
636636
let (stdout, _) = try runTask([xdgTestHelperURL().path, "--getcwd"], currentDirectoryPath: "/")
637-
XCTAssertEqual(stdout.trimmingCharacters(in: CharacterSet(["\n", "\r"])), "/")
637+
var directory = stdout.trimmingCharacters(in: CharacterSet(["\n", "\r"]))
638+
#if os(Windows)
639+
let zero: String.Index = directory.startIndex
640+
let one: String.Index = directory.index(zero, offsetBy: 1)
641+
XCTAssertTrue(directory[zero].isLetter)
642+
XCTAssertEqual(directory[one], ":")
643+
directory = "/" + String(directory.dropFirst(2))
644+
#endif
645+
XCTAssertEqual(URL(fileURLWithPath: directory).absoluteURL,
646+
URL(fileURLWithPath: "/").absoluteURL)
638647
}
639648

640649
do {

0 commit comments

Comments
 (0)