Skip to content

Tests: adjust PackageModelTests for Windows #6686

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
Aug 17, 2023

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Jul 8, 2023

Adjust the path spelling for the native path arc separator and escaping
for the encoding in the JSON. Windows uses \ as the path arc
separator which needs to be escaped for ensuring that the JSON is valid.

@compnerd
Copy link
Member Author

compnerd commented Jul 8, 2023

@swift-ci please smoke test

@compnerd
Copy link
Member Author

compnerd commented Jul 9, 2023

@swift-ci please smoke test

@compnerd
Copy link
Member Author

compnerd commented Jul 9, 2023

@swift-ci please test Windows platform

@compnerd
Copy link
Member Author

@swift-ci please smoke test

@tomerd
Copy link
Contributor

tomerd commented Jul 10, 2023

all these use of _nativePathString(escaped: true) makes me feel bit uncomfortable and maybe pointing to something more broadly missing

@compnerd
Copy link
Member Author

all these use of _nativePathString(escaped: true) makes me feel bit uncomfortable and maybe pointing to something more broadly missing

I don't feel that is the case. We need to ensure that the JSON that we are hardcoding here is valid - the paths have \ as the arc separator, we need to escape them.

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@tomerd
Copy link
Contributor

tomerd commented Jul 10, 2023

all these use of _nativePathString(escaped: true) makes me feel bit uncomfortable and maybe pointing to something more broadly missing

I don't feel that is the case. We need to ensure that the JSON that we are hardcoding here is valid - the paths have \ as the arc separator, we need to escape them.

right, I understand why it was done. the point is that if need to litter too many of our tests with _nativePathString(escaped: true) it points to needing a different approach potentially

@compnerd
Copy link
Member Author

all these use of _nativePathString(escaped: true) makes me feel bit uncomfortable and maybe pointing to something more broadly missing

I don't feel that is the case. We need to ensure that the JSON that we are hardcoding here is valid - the paths have \ as the arc separator, we need to escape them.

right, I understand why it was done. the point is that if need to litter too many of our tests with _nativePathString(escaped: true) it points to needing a different approach potentially

The only alternative that comes to mind is to encode the structure and rely on Codable to serialise to a JSON string.

Adjust the expectations to use the native path spelling.
@compnerd
Copy link
Member Author

@swift-ci please smoke test

Copy link
Contributor

@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.

Nice, thank you!

@compnerd compnerd merged commit dfd70cf into swiftlang:main Aug 17, 2023
@compnerd compnerd deleted the modelling branch August 17, 2023 17:43
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.

3 participants