Probably redundant tests, but why not

This commit is contained in:
Max Howell
2020-02-09 14:38:20 -05:00
parent 6e37bfde4d
commit 6e99825d9f
2 changed files with 7 additions and 0 deletions

View File

@@ -653,6 +653,12 @@ class PathTests: XCTestCase {
XCTAssertEqual(bar.type, .symlink) XCTAssertEqual(bar.type, .symlink)
} }
} }
func testOptionalInitializer() throws {
XCTAssertNil(Path(""))
XCTAssertNil(Path("./foo"))
XCTAssertEqual(Path("/foo"), Path.root.foo)
}
} }
private func XCTAssertEqual<P: Pathish, Q: Pathish>(_ p: P, _ q: Q, file: StaticString = #file, line: UInt = #line) { private func XCTAssertEqual<P: Pathish, Q: Pathish>(_ p: P, _ q: Q, file: StaticString = #file, line: UInt = #line) {

View File

@@ -46,6 +46,7 @@ extension PathTests {
("testMoveInto", testMoveInto), ("testMoveInto", testMoveInto),
("testMoveTo", testMoveTo), ("testMoveTo", testMoveTo),
("testNoUndesiredSymlinkResolution", testNoUndesiredSymlinkResolution), ("testNoUndesiredSymlinkResolution", testNoUndesiredSymlinkResolution),
("testOptionalInitializer", testOptionalInitializer),
("testPathComponents", testPathComponents), ("testPathComponents", testPathComponents),
("testReadlinkOnFileReturnsSelf", testReadlinkOnFileReturnsSelf), ("testReadlinkOnFileReturnsSelf", testReadlinkOnFileReturnsSelf),
("testReadlinkOnNonExistantFileThrows", testReadlinkOnNonExistantFileThrows), ("testReadlinkOnNonExistantFileThrows", testReadlinkOnNonExistantFileThrows),