Skip to content

Commit 016082a

Browse files
authored
Tests: adjust for sorting and path representation (#7112)
The expectations sort differently on Windows due to the path separator being different. This also impacts the expectations. Adjust the path spellings to use `AbsolutePath(_:)` to get the canonical path spelling for the platform.
1 parent c69ee5f commit 016082a

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

Tests/BuildTests/LLBuildManifestBuilderTests.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ final class LLBuildManifestBuilderTests: XCTestCase {
6767
try llbuild.createProductCommand(buildProduct)
6868

6969
let basicReleaseCommandNames = [
70-
"/path/to/build/release/exe.product/Objects.LinkFileList",
70+
AbsolutePath("/path/to/build/release/exe.product/Objects.LinkFileList").pathString,
7171
"<exe-release.exe>",
7272
"C.exe-release.exe",
7373
]
7474

7575
XCTAssertEqual(
7676
llbuild.manifest.commands.map(\.key).sorted(),
77-
basicReleaseCommandNames
77+
basicReleaseCommandNames.sorted()
7878
)
7979

8080
// macOS, debug build
@@ -98,18 +98,17 @@ final class LLBuildManifestBuilderTests: XCTestCase {
9898

9999
let entitlementsCommandName = "C.exe-debug.exe-entitlements"
100100
let basicDebugCommandNames = [
101-
"/path/to/build/debug/exe.product/Objects.LinkFileList",
101+
AbsolutePath("/path/to/build/debug/exe.product/Objects.LinkFileList").pathString,
102102
"<exe-debug.exe>",
103103
"C.exe-debug.exe",
104104
]
105105

106106
XCTAssertEqual(
107107
llbuild.manifest.commands.map(\.key).sorted(),
108-
[
109-
"/path/to/build/debug/exe-entitlement.plist",
110-
] + basicDebugCommandNames + [
108+
(basicDebugCommandNames + [
109+
AbsolutePath("/path/to/build/debug/exe-entitlement.plist").pathString,
111110
entitlementsCommandName,
112-
]
111+
]).sorted()
113112
)
114113

115114
guard let entitlementsCommand = llbuild.manifest.commands[entitlementsCommandName]?.tool as? ShellTool else {
@@ -152,7 +151,7 @@ final class LLBuildManifestBuilderTests: XCTestCase {
152151

153152
XCTAssertEqual(
154153
llbuild.manifest.commands.map(\.key).sorted(),
155-
basicReleaseCommandNames
154+
basicReleaseCommandNames.sorted()
156155
)
157156

158157
// Linux, debug build
@@ -176,7 +175,7 @@ final class LLBuildManifestBuilderTests: XCTestCase {
176175

177176
XCTAssertEqual(
178177
llbuild.manifest.commands.map(\.key).sorted(),
179-
basicDebugCommandNames
178+
basicDebugCommandNames.sorted()
180179
)
181180
}
182181
}

Tests/BuildTests/ModuleAliasingBuildTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4692,7 +4692,7 @@ final class ModuleAliasingBuildTests: XCTestCase {
46924692

46934693
XCTFail("unexpectedly resolved the package graph successfully")
46944694
} catch {
4695-
XCTAssertEqual(error.interpolationDescription, "multiple products named 'SomeProduct' in: 'other' (at '/Other'), 'some' (at '/Some')")
4695+
XCTAssertEqual(error.interpolationDescription, "multiple products named 'SomeProduct' in: 'other' (at '\(AbsolutePath("/Other"))'), 'some' (at '\(AbsolutePath("/Some"))')")
46964696
}
46974697
XCTAssertEqual(observability.diagnostics.map { $0.description }.sorted(), ["[warning]: product aliasing requires tools-version 5.2 or later, so it is not supported by \'other\'", "[warning]: product aliasing requires tools-version 5.2 or later, so it is not supported by \'some\'"])
46984698
}

0 commit comments

Comments
 (0)