Skip to content

Tests: Split SerializedJSONTests #8496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions Tests/BasicsTests/Serialization/SerializedJSONTests.swift
Original file line number Diff line number Diff line change
@@ -16,8 +16,6 @@ import _InternalTestSupport // for skipOnWindowsAsTestCurrentlyFails

final class SerializedJSONTests: XCTestCase {
func testPathInterpolation() throws {
try skipOnWindowsAsTestCurrentlyFails()

var path = try AbsolutePath(validating: #"/test\backslashes"#)
var json: SerializedJSON = "\(path)"

@@ -28,20 +26,26 @@ final class SerializedJSONTests: XCTestCase {
#endif

#if os(Windows)
path = try AbsolutePath(validating: #"\\?\C:\Users"#)
path = try AbsolutePath(validating: #"\??\Volumes{b79de17a-a1ed-4c58-a353-731b7c4885a6}\\"#)
json = "\(path)"

XCTAssertEqual(json.underlying, #"\\??\\Volumes{b79de17a-a1ed-4c58-a353-731b7c4885a6}"#)
#endif
}

func testPathInterpolationFailsOnWindows() throws {
try skipOnWindowsAsTestCurrentlyFails(because: "Expectations are not met")

#if os(Windows)
var path = try AbsolutePath(validating: #"\\?\C:\Users"#)
var json: SerializedJSON = "\(path)"

XCTAssertEqual(json.underlying, #"C:\\Users"#)

path = try AbsolutePath(validating: #"\\.\UNC\server\share\"#)
json = "\(path)"

XCTAssertEqual(json.underlying, #"\\.\\UNC\\server\\share"#)

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

XCTAssertEqual(json.underlying, #"\\??\\Volumes{b79de17a-a1ed-4c58-a353-731b7c4885a6}"#)
#endif
#endif
}
}