Skip to content

Commit ba1d435

Browse files
committed
Use Windows file paths for fake output paths
1 parent cd6db00 commit ba1d435

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,20 +2180,40 @@ final class BackgroundIndexingTests: XCTestCase {
21802180
private let libATarget = BuildTargetIdentifier(uri: try! URI(string: "build://targetA"))
21812181
private let libBTarget = BuildTargetIdentifier(uri: try! URI(string: "build://targetB"))
21822182

2183+
private func fakeOutputPath(for file: String, in target: String) -> String {
2184+
#if os(Windows)
2185+
return #"C:\"# + target + #"\"# + file + ".o"
2186+
#else
2187+
return "/" + target + "/" + file + ".o"
2188+
#endif
2189+
}
2190+
21832191
private var sources: [SourcesItem] {
21842192
return [
21852193
SourcesItem(
21862194
target: libATarget,
21872195
sources: [
2188-
sourceItem(for: projectRoot.appendingPathComponent("Shared.swift"), outputPath: "/LibA/Shared.swift.o"),
2189-
sourceItem(for: projectRoot.appendingPathComponent("LibA.swift"), outputPath: "/LibA/LibA.swift.o"),
2196+
sourceItem(
2197+
for: projectRoot.appendingPathComponent("Shared.swift"),
2198+
outputPath: fakeOutputPath(for: "Shared.swift", in: "LibA")
2199+
),
2200+
sourceItem(
2201+
for: projectRoot.appendingPathComponent("LibA.swift"),
2202+
outputPath: fakeOutputPath(for: "LibA.swift", in: "LibA")
2203+
),
21902204
]
21912205
),
21922206
SourcesItem(
21932207
target: libBTarget,
21942208
sources: [
2195-
sourceItem(for: projectRoot.appendingPathComponent("Shared.swift"), outputPath: "/LibB/Shared.swift.o"),
2196-
sourceItem(for: projectRoot.appendingPathComponent("LibB.swift"), outputPath: "/LibB/LibB.swift.o"),
2209+
sourceItem(
2210+
for: projectRoot.appendingPathComponent("Shared.swift"),
2211+
outputPath: fakeOutputPath(for: "Shared.swift", in: "LibB")
2212+
),
2213+
sourceItem(
2214+
for: projectRoot.appendingPathComponent("LibB.swift"),
2215+
outputPath: fakeOutputPath(for: "LibB.swift", in: "LibB")
2216+
),
21972217
]
21982218
),
21992219
]

0 commit comments

Comments
 (0)