Skip to content

Commit abb574c

Browse files
committed
[Windows] Fix TestURL/test_URLStrings
Since '|' is a valid character in a url on Windows as implemented by CoreFoundation, on Windows, we should expect that `unescaped|pipe` should be properly parsed. This is hacky, but adds a test case on Windows, and disables it on other platforms and vice versa.
1 parent 05cb315 commit abb574c

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

TestFoundation/Resources/NSURLTestData.plist

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3501,6 +3501,60 @@
35013501
<key>Out-NSResults</key>
35023502
<string>&lt;null url&gt;</string>
35033503
</dict>
3504+
<dict>
3505+
<key>In-Title</key>
3506+
<string>NSURLWithString-parse-absolute-escape-006-Windows</string>
3507+
<key>In-URLCreator</key>
3508+
<string>NSURLWithString</string>
3509+
<key>In-Url</key>
3510+
<string>http://test.com/unescaped|pipe</string>
3511+
<key>Out-NSResults</key>
3512+
<dict>
3513+
<key>absoluteString</key>
3514+
<string>http://test.com/unescaped%7Cpipe</string>
3515+
<key>absoluteURLString</key>
3516+
<string>http://test.com/unescaped%7Cpipe</string>
3517+
<key>baseURLString</key>
3518+
<string>&lt;null&gt;</string>
3519+
<key>deletingLastPathComponent</key>
3520+
<string>http://test.com/</string>
3521+
<key>deletingLastPathExtension</key>
3522+
<string>http://test.com/unescaped%7Cpipe</string>
3523+
<key>fragment</key>
3524+
<string>&lt;null&gt;</string>
3525+
<key>host</key>
3526+
<string>test.com</string>
3527+
<key>isFileURL</key>
3528+
<string>NO</string>
3529+
<key>lastPathComponent</key>
3530+
<string>unescaped|pipe</string>
3531+
<key>password</key>
3532+
<string>&lt;null&gt;</string>
3533+
<key>path</key>
3534+
<string>/unescaped|pipe</string>
3535+
<key>pathComponents</key>
3536+
<array>
3537+
<string>/</string>
3538+
<string>unescaped|pipe</string>
3539+
</array>
3540+
<key>pathExtension</key>
3541+
<string></string>
3542+
<key>port</key>
3543+
<string>&lt;null&gt;</string>
3544+
<key>query</key>
3545+
<string>&lt;null&gt;</string>
3546+
<key>relativePath</key>
3547+
<string>/unescaped|pipe</string>
3548+
<key>relativeString</key>
3549+
<string>http://test.com/unescaped%7Cpipe</string>
3550+
<key>scheme</key>
3551+
<string>http</string>
3552+
<key>standardizedURL</key>
3553+
<string>http://test.com/unescaped%7Cpipe</string>
3554+
<key>user</key>
3555+
<string>&lt;null&gt;</string>
3556+
</dict>
3557+
</dict>
35043558
<dict>
35053559
<key>In-Title</key>
35063560
<string>NSURLWithString-parse-absolute-escape-007</string>

TestFoundation/TestURL.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,15 @@ class TestURL : XCTestCase {
248248
default:
249249
XCTFail()
250250
}
251-
if title == "NSURLWithString-parse-ambiguous-url-001" {
251+
#if os(Windows)
252+
// On Windows, pipes are valid charcters which can be used
253+
// to replace a ':'. See RFC 8089 Section E.2.2 for
254+
// details.
255+
let otherPlatformPipeTest = "NSURLWithString-parse-absolute-escape-006"
256+
#else
257+
let otherPlatformPipeTest = "NSURLWithString-parse-absolute-escape-006-Windows"
258+
#endif
259+
if title == "NSURLWithString-parse-ambiguous-url-001" || title == otherPlatformPipeTest {
252260
// TODO: Fix this test
253261
} else {
254262
if let url = url {

0 commit comments

Comments
 (0)