Skip to content

Commit e08363e

Browse files
committed
Tests: adjust the tests for path spellings
Tweak the expectations to account for the path component separator on Windows. This improves the test coverage on Windows.
1 parent fab4533 commit e08363e

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Tests/PackageGraphTests/PackageGraphTests.swift

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,24 +1197,27 @@ class PackageGraphTests: XCTestCase {
11971197
"/Bar/Sources/Bar/bar.swift",
11981198
"/Baz/Sources/Baz/baz.swift"
11991199
)
1200+
let fooPkg: AbsolutePath = "/Foo"
1201+
let barPkg: AbsolutePath = "/Bar"
1202+
let bazPkg: AbsolutePath = "/Baz"
12001203

12011204
let observability = ObservabilitySystem.makeForTesting()
12021205
XCTAssertThrowsError(try loadPackageGraph(
12031206
fileSystem: fs,
12041207
manifests: [
12051208
Manifest.createRootManifest(
12061209
displayName: "Foo",
1207-
path: "/Foo",
1210+
path: fooPkg,
12081211
dependencies: [
1209-
.localSourceControl(path: "/Bar", requirement: .upToNextMajor(from: "1.0.0")),
1210-
.localSourceControl(path: "/Baz", requirement: .upToNextMajor(from: "1.0.0")),
1212+
.localSourceControl(path: barPkg, requirement: .upToNextMajor(from: "1.0.0")),
1213+
.localSourceControl(path: bazPkg, requirement: .upToNextMajor(from: "1.0.0")),
12111214
],
12121215
targets: [
12131216
TargetDescription(name: "Foo", dependencies: ["Bar"]),
12141217
]),
12151218
Manifest.createFileSystemManifest(
12161219
displayName: "Bar",
1217-
path: "/Bar",
1220+
path: barPkg,
12181221
products: [
12191222
ProductDescription(name: "Bar", type: .library(.automatic), targets: ["Bar"])
12201223
],
@@ -1223,7 +1226,7 @@ class PackageGraphTests: XCTestCase {
12231226
]),
12241227
Manifest.createFileSystemManifest(
12251228
displayName: "Baz",
1226-
path: "/Baz",
1229+
path: bazPkg,
12271230
products: [
12281231
ProductDescription(name: "Bar", type: .library(.automatic), targets: ["Baz"])
12291232
],
@@ -1233,7 +1236,8 @@ class PackageGraphTests: XCTestCase {
12331236
],
12341237
observabilityScope: observability.topScope
12351238
)) { error in
1236-
XCTAssertEqual((error as? PackageGraphError)?.description, "multiple products named 'Bar' in: 'bar' (at '/Bar'), 'baz' (at '/Baz')")
1239+
XCTAssertEqual((error as? PackageGraphError)?.description,
1240+
"multiple products named 'Bar' in: 'bar' (at '\(barPkg)'), 'baz' (at '\(bazPkg)')")
12371241
}
12381242
}
12391243

@@ -1506,7 +1510,7 @@ class PackageGraphTests: XCTestCase {
15061510
let pinsFile = AbsolutePath("/pins")
15071511
try fs.writeFileContents(pinsFile, string: json)
15081512

1509-
XCTAssertThrows(StringError("/pins file is corrupted or malformed; fix or delete the file to continue: duplicated entry for package \"yams\""), {
1513+
XCTAssertThrows(StringError("\(pinsFile) file is corrupted or malformed; fix or delete the file to continue: duplicated entry for package \"yams\""), {
15101514
_ = try PinsStore(pinsFile: pinsFile, workingDirectory: .root, fileSystem: fs, mirrors: .init())
15111515
})
15121516
}

0 commit comments

Comments
 (0)