Skip to content

Commit 9531e96

Browse files
committed
Tests: adjust PackageModelTests for Windows
Adjust the path spelling for the native path arc separator and escaping for the encoding in the JSON.
1 parent 696e9d7 commit 9531e96

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Tests/PackageModelTests/DestinationTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ private let destinationV1 = (
3535
json: #"""
3636
{
3737
"version": 1,
38-
"sdk": "\#(bundleRootPath.appending(sdkRootDir))",
39-
"toolchain-bin-dir": "\#(bundleRootPath.appending(toolchainBinDir))",
38+
"sdk": "\#(bundleRootPath.appending(sdkRootDir)._nativePathString(escaped: true))",
39+
"toolchain-bin-dir": "\#(bundleRootPath.appending(toolchainBinDir)._nativePathString(escaped: true))",
4040
"target": "\#(linuxGNUTargetTriple.tripleString)",
4141
"extra-cc-flags": \#(extraFlags.cCompilerFlags),
4242
"extra-swiftc-flags": \#(extraFlags.swiftCompilerFlags),
@@ -51,7 +51,7 @@ private let destinationV2 = (
5151
{
5252
"version": 2,
5353
"sdkRootDir": "\#(sdkRootDir)",
54-
"toolchainBinDir": "\#(toolchainBinDir)",
54+
"toolchainBinDir": "\#(toolchainBinDir.pathString.replacingOccurrences(of: "\\", with: "\\\\"))",
5555
"hostTriples": ["\#(hostTriple.tripleString)"],
5656
"targetTriples": ["\#(linuxGNUTargetTriple.tripleString)"],
5757
"extraCCFlags": \#(extraFlags.cCompilerFlags),
@@ -330,7 +330,7 @@ final class DestinationTests: XCTestCase {
330330
$0 as? StringError,
331331
StringError(
332332
"""
333-
Couldn't parse toolset configuration at `/tools/asdf.json`: /tools/asdf.json doesn't exist in file \
333+
Couldn't parse toolset configuration at `\(AbsolutePath("/tools/asdf.json")._nativePathString(escaped: false))`: \(AbsolutePath("/tools/asdf.json")._nativePathString(escaped: false)) doesn't exist in file \
334334
system
335335
"""
336336
)
@@ -349,7 +349,7 @@ final class DestinationTests: XCTestCase {
349349
)) {
350350
XCTAssertTrue(
351351
($0 as? StringError)?.description
352-
.hasPrefix("Couldn't parse toolset configuration at `/tools/invalidToolset.json`: ") ?? false
352+
.hasPrefix("Couldn't parse toolset configuration at `\(AbsolutePath("/tools/invalidToolset.json")._nativePathString(escaped: false))`: ") ?? false
353353
)
354354
}
355355
}

0 commit comments

Comments
 (0)