Skip to content

Commit ae11b44

Browse files
committed
Fix test failing in different environment
1 parent edbe4f5 commit ae11b44

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

Tests/XcodeBSPTests/BuildTargetSourcesTests.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,21 @@ final class BuildTargetSourcesTests: XCTestCase {
7979

8080
XCTAssertEqual(result.items.count, 1)
8181
XCTAssertEqual(result.items[0].sources.map(\.uri), [URL(filePath: filePath).absoluteString])
82+
func trimTrailingSlashes(_ path: String) -> String {
83+
var value = path
84+
while value.count > 1, value.hasSuffix("/") {
85+
value.removeLast()
86+
}
87+
return value
88+
}
89+
90+
let rootPaths = try result.items[0].roots.map { uri -> String in
91+
let url = try XCTUnwrap(URL(string: uri))
92+
return trimTrailingSlashes(URL(filePath: url.path()).standardizedFileURL.path())
93+
}
8294
XCTAssertEqual(
83-
result.items[0].roots,
84-
[URL(filePath: "/tmp/Project/Sources").appending(path: "/").absoluteString]
95+
rootPaths,
96+
[trimTrailingSlashes("/tmp/Project/Sources")]
8597
)
8698
}
8799
}

0 commit comments

Comments
 (0)