Skip to content
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

Tests: special case deserialisation on Windows #6980

Merged
merged 1 commit into from Oct 10, 2023

Conversation

compnerd
Copy link
Collaborator

@compnerd compnerd commented Oct 8, 2023

The content being compared here is the actual file content which is apparently not escaped. This matches the expectations by explicitly converting the string form of the path rather than the default which escapes it.

@compnerd
Copy link
Collaborator Author

compnerd commented Oct 8, 2023

@swift-ci please test

Comment on lines 4853 to 4856
let inputs: SerializedJSON = """
inputs: ["\(AbsolutePath("/Pkg/Snippets/ASnippet.swift"))","\(swiftGetVersionFilePath.escapedPathString)","\(AbsolutePath("/Pkg/.build/debug/Lib.swiftmodule"))"
inputs: ["\(AbsolutePath("/Pkg/Snippets/ASnippet.swift")._nativePathString(escaped: false))","\(swiftGetVersionFilePath.escapedPathString)","\(AbsolutePath("/Pkg/.build/debug/Lib.swiftmodule")._nativePathString(escaped: false))"
"""
XCTAssertMatch(yamlContents, .contains(inputs.underlying))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If inputs type is changed to plain String, that will use string interpolation of AbsolutePath that calls _nativePathString(escaped: false) automatically.

Suggested change
let inputs: SerializedJSON = """
inputs: ["\(AbsolutePath("/Pkg/Snippets/ASnippet.swift"))","\(swiftGetVersionFilePath.escapedPathString)","\(AbsolutePath("/Pkg/.build/debug/Lib.swiftmodule"))"
inputs: ["\(AbsolutePath("/Pkg/Snippets/ASnippet.swift")._nativePathString(escaped: false))","\(swiftGetVersionFilePath.escapedPathString)","\(AbsolutePath("/Pkg/.build/debug/Lib.swiftmodule")._nativePathString(escaped: false))"
"""
XCTAssertMatch(yamlContents, .contains(inputs.underlying))
let inputs = """
inputs: ["\(AbsolutePath("/Pkg/Snippets/ASnippet.swift"))","\(swiftGetVersionFilePath.escapedPathString)","\(AbsolutePath("/Pkg/.build/debug/Lib.swiftmodule"))"
"""
XCTAssertMatch(yamlContents, .contains(inputs))

Copy link
Member

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@compnerd
Copy link
Collaborator Author

compnerd commented Oct 9, 2023

@swift-ci please test

@MaxDesiatov
Copy link
Member

@swift-ci test windows

The content being compared here is the actual file content which is
apparently not escaped.  This matches the expectations by explicitly
converting the string form of the path rather than the default which
escapes it.
@compnerd
Copy link
Collaborator Author

compnerd commented Oct 9, 2023

@swift-ci please test

@compnerd
Copy link
Collaborator Author

compnerd commented Oct 9, 2023

@swift-ci please test Windows platform

@compnerd compnerd merged commit 052c298 into apple:main Oct 10, 2023
5 checks passed
@compnerd compnerd deleted the captured branch October 10, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants