Fix copy(into:) overwrite mode

Seems like Linux Foundation has a bug

I checked, seems fixed in Swift 5. But added a swift version check se we can verify and if not report the bug.
This commit is contained in:
Max Howell
2019-01-22 18:52:57 +00:00
parent 43d3e0a745
commit 58d026c8a9
3 changed files with 26 additions and 4 deletions

View File

@@ -138,4 +138,15 @@ class PathTests: XCTestCase {
XCTAssertEqual(Path.root/"a/foo"/"../../bar", Path.root/"bar")
XCTAssertEqual(Path.root/"a/foo"/"../../../bar", Path.root/"bar")
}
func testCopyInto() throws {
try Path.mktemp { root in
let bar = try root.join("bar").touch()
try Path.mktemp { root in
try root.join("bar").touch()
XCTAssertThrowsError(try bar.copy(into: root))
try bar.copy(into: root, overwrite: true)
}
}
}
}

View File

@@ -5,6 +5,7 @@ extension PathTests {
("testBasename", testBasename),
("testCodable", testCodable),
("testConcatenation", testConcatenation),
("testCopyInto", testCopyInto),
("testEnumeration", testEnumeration),
("testEnumerationSkippingHiddenFiles", testEnumerationSkippingHiddenFiles),
("testExists", testExists),