Remaining code coverage
Can’t do coverage for Linux unfortunately.
This commit is contained in:
@@ -164,6 +164,14 @@ class PathTests: XCTestCase {
|
|||||||
XCTAssertEqual(a.Documents, Path.home/"foo/Documents")
|
XCTAssertEqual(a.Documents, Path.home/"foo/Documents")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testCopyTo() throws {
|
||||||
|
try Path.mktemp { root in
|
||||||
|
try root.foo.touch().copy(to: root.bar)
|
||||||
|
XCTAssert(root.foo.isFile)
|
||||||
|
XCTAssert(root.bar.isFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testCopyInto() throws {
|
func testCopyInto() throws {
|
||||||
try Path.mktemp { root1 in
|
try Path.mktemp { root1 in
|
||||||
let bar1 = try root1.join("bar").touch()
|
let bar1 = try root1.join("bar").touch()
|
||||||
@@ -177,6 +185,14 @@ class PathTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testMoveTo() throws {
|
||||||
|
try Path.mktemp { root in
|
||||||
|
try root.foo.touch().move(to: root.bar)
|
||||||
|
XCTAssertFalse(root.foo.exists)
|
||||||
|
XCTAssert(root.bar.isFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testMoveInto() throws {
|
func testMoveInto() throws {
|
||||||
try Path.mktemp { root1 in
|
try Path.mktemp { root1 in
|
||||||
let bar1 = try root1.join("bar").touch()
|
let bar1 = try root1.join("bar").touch()
|
||||||
@@ -313,12 +329,28 @@ class PathTests: XCTestCase {
|
|||||||
XCTAssertTrue(Bundle.main.path.isDirectory)
|
XCTAssertTrue(Bundle.main.path.isDirectory)
|
||||||
XCTAssertTrue(Bundle.main.resources.isDirectory)
|
XCTAssertTrue(Bundle.main.resources.isDirectory)
|
||||||
|
|
||||||
// doesn’t exist in tests
|
// don’t exist in tests
|
||||||
|
_ = Bundle.main.path(forResource: "foo", ofType: "bar")
|
||||||
_ = Bundle.main.sharedFrameworks
|
_ = Bundle.main.sharedFrameworks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testDataExentsions() throws {
|
||||||
|
let data = try Data(contentsOf: Path(#file)!)
|
||||||
|
try Path.mktemp { tmpdir in
|
||||||
|
_ = try data.write(to: tmpdir.foo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testStringExentsions() throws {
|
||||||
|
let string = try String(contentsOf: Path(#file)!)
|
||||||
|
try Path.mktemp { tmpdir in
|
||||||
|
_ = try string.write(to: tmpdir.foo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testFileHandleExtensions() throws {
|
func testFileHandleExtensions() throws {
|
||||||
_ = try FileHandle(forReadingAt: Path(#file)!)
|
_ = try FileHandle(forReadingAt: Path(#file)!)
|
||||||
_ = try FileHandle(forWritingAt: Path(#file)!)
|
_ = try FileHandle(forWritingAt: Path(#file)!)
|
||||||
|
_ = try FileHandle(forUpdatingAt: Path(#file)!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ extension PathTests {
|
|||||||
("testCommonDirectories", testCommonDirectories),
|
("testCommonDirectories", testCommonDirectories),
|
||||||
("testConcatenation", testConcatenation),
|
("testConcatenation", testConcatenation),
|
||||||
("testCopyInto", testCopyInto),
|
("testCopyInto", testCopyInto),
|
||||||
|
("testCopyTo", testCopyTo),
|
||||||
|
("testDataExentsions", testDataExentsions),
|
||||||
("testDelete", testDelete),
|
("testDelete", testDelete),
|
||||||
("testDynamicMember", testDynamicMember),
|
("testDynamicMember", testDynamicMember),
|
||||||
("testEnumeration", testEnumeration),
|
("testEnumeration", testEnumeration),
|
||||||
@@ -21,11 +23,13 @@ extension PathTests {
|
|||||||
("testMkpathIfExists", testMkpathIfExists),
|
("testMkpathIfExists", testMkpathIfExists),
|
||||||
("testMktemp", testMktemp),
|
("testMktemp", testMktemp),
|
||||||
("testMoveInto", testMoveInto),
|
("testMoveInto", testMoveInto),
|
||||||
|
("testMoveTo", testMoveTo),
|
||||||
("testRelativeCodable", testRelativeCodable),
|
("testRelativeCodable", testRelativeCodable),
|
||||||
("testRelativePathCodable", testRelativePathCodable),
|
("testRelativePathCodable", testRelativePathCodable),
|
||||||
("testRelativeTo", testRelativeTo),
|
("testRelativeTo", testRelativeTo),
|
||||||
("testRename", testRename),
|
("testRename", testRename),
|
||||||
("testStringConvertibles", testStringConvertibles),
|
("testStringConvertibles", testStringConvertibles),
|
||||||
|
("testStringExentsions", testStringExentsions),
|
||||||
("testTimes", testTimes),
|
("testTimes", testTimes),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user