Skip to content

Commit 912fb83

Browse files
committed
[Windows] Test file URL with leading slash
1 parent 5e0b63d commit 912fb83

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

TestFoundation/TestURL.swift

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

9999
let u4 = URL(fileURLWithPath: "S:\\b\\u3//\\//")
100100
XCTAssertEqual(u4.absoluteString, "file:///S:/b/u3/")
101+
102+
// ensure leading slash doesn't break everything
103+
let u5 = URL(fileURLWithPath: "\\abs\\path")
104+
XCTAssertEqual(u5.absoluteString, "file:///abs/path")
105+
XCTAssertEqual(u5.path, "/abs/path")
106+
107+
let u6 = u5.appendingPathComponent("test")
108+
XCTAssertEqual(u6.absoluteString, "file:///abs/path/test")
109+
XCTAssertEqual(u6.path, "/abs/path/test")
110+
111+
let u7 = u6.deletingLastPathComponent()
112+
XCTAssertEqual(u7.absoluteString, "file:///abs/path/")
113+
XCTAssertEqual(u7.path, "/abs/path")
101114
}
102115
#endif
103116

0 commit comments

Comments
 (0)