Skip to content

Commit f80087a

Browse files
authored
Merge pull request #2670 from readdle/absolutely-no-drive
[Windows] Test file URL with leading slash
2 parents 73b22b1 + e126af9 commit f80087a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Tests/Foundation/Tests/TestURL.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ class TestURL : XCTestCase {
105105

106106
let u4 = URL(fileURLWithPath: "S:\\b\\u3//\\//")
107107
XCTAssertEqual(u4.absoluteString, "file:///S:/b/u3/")
108+
109+
// ensure leading slash doesn't break everything
110+
let u5 = URL(fileURLWithPath: "\\abs\\path")
111+
XCTAssertEqual(u5.absoluteString, "file:///abs/path")
112+
XCTAssertEqual(u5.path, "/abs/path")
113+
114+
let u6 = u5.appendingPathComponent("test")
115+
XCTAssertEqual(u6.absoluteString, "file:///abs/path/test")
116+
XCTAssertEqual(u6.path, "/abs/path/test")
117+
118+
let u7 = u6.deletingLastPathComponent()
119+
XCTAssertEqual(u7.absoluteString, "file:///abs/path/")
120+
XCTAssertEqual(u7.path, "/abs/path")
108121
}
109122
#endif
110123

0 commit comments

Comments
 (0)