Closed
Description
Describe the bug
I'm converting our assertion helper that tests our API client routes generate the correct URL requests over to the new inline snapshot tool. It works well except for one test that uses my swift-url-routing-multipart
extension to create a multipart request body. This intentionally contains \r\n
line breaks, but these get converted to \n
when written into the source file using the .raw
strategy, causing the test to fail when re-run.
func testCarriageReturnInlineSnapshot() {
let string = "This is a line\r\nAnd this is a line\r\n"
var request = URLRequest(url: URL(string: "https://www.example.com")!)
request.httpMethod = "POST"
request.httpBody = string.data(using: .utf8)!
assertInlineSnapshot(of: request, as: .raw) {
"""
POST https://www.example.com
This is a line
And this is a line
"""
}
}
Expected behavior
I'd expect the original line breaks to be preserved.
Environment
- swift-snapshot-testing 1.13.0
- Xcode 14.3
- OS: iOS 16
Metadata
Metadata
Assignees
Labels
No labels