Skip to content

Commit 76f291b

Browse files
committed
Tests: adjust the SerializedJSONTests on Windows
The extra Windows specific test cases did not account for the path normalization that occurs as part of the `AbsolutePath` construction. Alter the expectations to match that. Additionally, on Windows, the `/test\\backslash` path would be normalized to `\test\backslash`.
1 parent 667a006 commit 76f291b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Tests/BasicsTests/Serialization/SerializedJSONTests.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,27 @@ final class SerializedJSONTests: XCTestCase {
1818
var path = try AbsolutePath(validating: #"/test\backslashes"#)
1919
var json: SerializedJSON = "\(path)"
2020

21+
#if os(Windows)
22+
XCTAssertEqual(json.underlying, #"\\test\\backslashes"#)
23+
#else
2124
XCTAssertEqual(json.underlying, #"/test\\backslashes"#)
25+
#endif
2226

2327
#if os(Windows)
2428
path = try AbsolutePath(validating: #"\\?\C:\Users"#)
2529
json = "\(path)"
2630

27-
XCTAssertEqual(json.underlying, #"\\\\?\\C:\\Users"#)
31+
XCTAssertEqual(json.underlying, #"C:\\Users"#)
2832

29-
path = try AbsolutePath(validating: #"\\.\UNC\server\share\n\"#)
33+
path = try AbsolutePath(validating: #"\\.\UNC\server\share\"#)
3034
json = "\(path)"
3135

32-
XCTAssertEqual(json.underlying, #"\\\\.\\UNC\\server\\share\\"#)
36+
XCTAssertEqual(json.underlying, #"\\.\\UNC\\server\\share"#)
3337

3438
path = try AbsolutePath(validating: #"\??\Volumes{b79de17a-a1ed-4c58-a353-731b7c4885a6}\\"#)
3539
json = "\(path)"
3640

37-
XCTAssertEqual(json.underlying, #"\\??\\Volumes{b79de17a-a1ed-4c58-a353-731b7c4885a6}\\"#)
41+
XCTAssertEqual(json.underlying, #"\\??\\Volumes{b79de17a-a1ed-4c58-a353-731b7c4885a6}"#)
3842
#endif
3943
}
4044
}

0 commit comments

Comments
 (0)