Remaining code coverage

Can’t do coverage for Linux unfortunately.
This commit is contained in:
Max Howell
2019-01-31 13:08:54 -05:00
parent 7970c4d8a7
commit ec6c0113f9
3 changed files with 38 additions and 2 deletions

View File

@@ -164,6 +164,14 @@ class PathTests: XCTestCase {
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 {
try Path.mktemp { root1 in
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 {
try Path.mktemp { root1 in
let bar1 = try root1.join("bar").touch()
@@ -313,12 +329,28 @@ class PathTests: XCTestCase {
XCTAssertTrue(Bundle.main.path.isDirectory)
XCTAssertTrue(Bundle.main.resources.isDirectory)
// doesnt exist in tests
// dont exist in tests
_ = Bundle.main.path(forResource: "foo", ofType: "bar")
_ = 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 {
_ = try FileHandle(forReadingAt: Path(#file)!)
_ = try FileHandle(forWritingAt: Path(#file)!)
_ = try FileHandle(forUpdatingAt: Path(#file)!)
}
}