Skip to content

Commit cb64183

Browse files
committed
Merge pull request #208 from czechboy0/hd/tests/more_path_tests
[Tests] Added more Path tests
2 parents 5c57057 + 9f8214f commit cb64183

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Sources/swift-build/main.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ do {
102102

103103
switch outpath {
104104
case let outpath? where outpath.hasSuffix(".xcodeproj"):
105-
// if user specified path ending with .xcodeproj, generate that
106-
"\(packageName).xcodeproj"
105+
// if user specified path ending with .xcodeproj, use that
107106
projectName = String(outpath.basename.characters.dropLast(10))
108107
dstdir = outpath.parentDirectory
109108
case let outpath?:

Tests/Utility/FileTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ extension RelativePathTests {
131131
("testAbsolute", testAbsolute),
132132
("testRelative", testRelative),
133133
("testMixed", testMixed),
134-
("testRelativeCommonSubprefix", testRelativeCommonSubprefix)
134+
("testRelativeCommonSubprefix", testRelativeCommonSubprefix),
135+
("testCombiningRelativePaths", testCombiningRelativePaths)
135136
]
136137
}
137138
}

Tests/Utility/PathTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,10 @@ class RelativePathTests: XCTestCase {
216216
XCTAssertEqual("../4/5", Path("/1/2/4/5").relative(to: "/1/2/3"))
217217
XCTAssertEqual("../../../4/5", Path("/1/2/4/5").relative(to: "/1/2/3/6/7"))
218218
}
219+
220+
func testCombiningRelativePaths() {
221+
XCTAssertEqual("/1/2/3", Path.join("/1/2/4", "../3").normpath)
222+
XCTAssertEqual("/1/2", Path.join("/1/2/3", "..").normpath)
223+
XCTAssertEqual("2", Path.join("2/3", "..").normpath)
224+
}
219225
}

0 commit comments

Comments
 (0)