-
Notifications
You must be signed in to change notification settings - Fork 226
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: normalise the fixtures path for Windows #785
Conversation
Approach looks ok, I'll merge when you fix the remaining issues causing tests to fail. |
@jpsim any idea why this would be failing? |
It's adding a trailing This fixes the macOS/Linux tests: // Strip out fixtures directory since it's dependent on the test machine's setup
let escapedFixturesDirectory = URL(fileURLWithPath: rootDirectory)
.standardizedFileURL
.withUnsafeFileSystemRepresentation { String(cString: $0!) }
.replacingOccurrences(of: #"\"#, with: #"\\"#)
.replacingOccurrences(of: "/", with: #"\/"#)
let escapedJSONString = jsonString.replacingOccurrences(of: escapedFixturesDirectory, with: "") Is it ok to have the Windows paths skip adding the trailing path separator? |
IIRC it was needed ... but I think that we can go with this for now, and come back around to when we can start running the tests? That will give us a better view of the failure. |
This diff makes me think that the trailing suffix is important? |
We can just do a separate codepath for Windows for the time being: // Strip out fixtures directory since it's dependent on the test machine's setup
#if os(Windows)
let escapedFixturesDirectory = URL(fileURLWithPath: rootDirectory)
.standardizedFileURL
.withUnsafeFileSystemRepresentation { String(cString: $0!) }
.replacingOccurrences(of: #"\"#, with: #"\\"#)
.replacingOccurrences(of: "/", with: #"\/"#)
#else
let escapedFixturesDirectory = rootDirectory.replacingOccurrences(of: "/", with: #"\/"#)
#endif
let escapedJSONString = jsonString.replacingOccurrences(of: escapedFixturesDirectory, with: "") Adjust that for whatever you need on the Windows side. |
Ensure that we normalise the path when we substitute the path into the results to properly remove the basename of the fixture.
Ensure that we normalise the path when we substitute the path into the results to properly remove the basename of the fixture.