diff --git a/TestFoundation/Resources/NSURLTestData.plist b/TestFoundation/Resources/NSURLTestData.plist
index 5c0f8b787a..443235abc0 100644
--- a/TestFoundation/Resources/NSURLTestData.plist
+++ b/TestFoundation/Resources/NSURLTestData.plist
@@ -3493,7 +3493,7 @@
In-Title
- NSURLWithString-parse-absolute-escape-006
+ NSURLWithString-parse-absolute-escape-006-pipe-invalid
In-URLCreator
NSURLWithString
In-Url
@@ -3501,6 +3501,60 @@
Out-NSResults
<null url>
+
+ In-Title
+ NSURLWithString-parse-absolute-escape-006-pipe-valid
+ In-URLCreator
+ NSURLWithString
+ In-Url
+ http://test.com/unescaped|pipe
+ Out-NSResults
+
+ absoluteString
+ http://test.com/unescaped%7Cpipe
+ absoluteURLString
+ http://test.com/unescaped%7Cpipe
+ baseURLString
+ <null>
+ deletingLastPathComponent
+ http://test.com/
+ deletingLastPathExtension
+ http://test.com/unescaped%7Cpipe
+ fragment
+ <null>
+ host
+ test.com
+ isFileURL
+ NO
+ lastPathComponent
+ unescaped|pipe
+ password
+ <null>
+ path
+ /unescaped|pipe
+ pathComponents
+
+ /
+ unescaped|pipe
+
+ pathExtension
+
+ port
+ <null>
+ query
+ <null>
+ relativePath
+ /unescaped|pipe
+ relativeString
+ http://test.com/unescaped%7Cpipe
+ scheme
+ http
+ standardizedURL
+ http://test.com/unescaped%7Cpipe
+ user
+ <null>
+
+
In-Title
NSURLWithString-parse-absolute-escape-007
diff --git a/TestFoundation/TestURL.swift b/TestFoundation/TestURL.swift
index c60c368c97..3477262b7c 100644
--- a/TestFoundation/TestURL.swift
+++ b/TestFoundation/TestURL.swift
@@ -248,25 +248,40 @@ class TestURL : XCTestCase {
default:
XCTFail()
}
- if title == "NSURLWithString-parse-ambiguous-url-001" {
- // TODO: Fix this test
- } else {
- if let url = url {
- let results = generateResults(url, pathComponent: inPathComponent, pathExtension: inPathExtension)
- if let expected = expectedNSResult as? [String: Any] {
- let (isEqual, differences) = compareResults(url, expected: expected, got: results)
- XCTAssertTrue(isEqual, "\(title): \(differences.joined(separator: "\n"))")
- } else {
- XCTFail("\(url) should not be a valid url")
- }
+
+#if os(Windows)
+ // On Windows, pipes are valid charcters which can be used
+ // to replace a ':'. See RFC 8089 Section E.2.2 for
+ // details.
+ //
+ // Skip the test which expects pipes to be invalid
+ let skippedPipeTest = "NSURLWithString-parse-absolute-escape-006-pipe-invalid"
+#else
+ // On other platforms, pipes are not valid
+ //
+ // Skip the test which expects pipes to be valid
+ let skippedPipeTest = "NSURLWithString-parse-absolute-escape-006-pipe-valid"
+#endif
+ let skippedTests = [
+ "NSURLWithString-parse-ambiguous-url-001", // TODO: Fix Test
+ skippedPipeTest,
+ ]
+ if skippedTests.contains(title) { continue }
+
+ if let url = url {
+ let results = generateResults(url, pathComponent: inPathComponent, pathExtension: inPathExtension)
+ if let expected = expectedNSResult as? [String: Any] {
+ let (isEqual, differences) = compareResults(url, expected: expected, got: results)
+ XCTAssertTrue(isEqual, "\(title): \(differences.joined(separator: "\n"))")
} else {
- XCTAssertEqual(expectedNSResult as? String, kNullURLString)
+ XCTFail("\(url) should not be a valid url")
}
+ } else {
+ XCTAssertEqual(expectedNSResult as? String, kNullURLString)
}
}
-
}
-
+
static let gBaseTemporaryDirectoryPath = (NSTemporaryDirectory() as NSString).appendingPathComponent("org.swift.foundation.TestFoundation.TestURL.\(ProcessInfo.processInfo.processIdentifier)")
static var gBaseCurrentWorkingDirectoryPath : String {
return FileManager.default.currentDirectoryPath