Skip to content

Commit 4b30573

Browse files
committed
Set -sdk in testCompletionUsingCompileFlagsTxt
Otherwise this test fails when run using an Xcode toolchain (instead of an open source toolchain).
1 parent b757fb9 commit 4b30573

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Tests/SourceKitLSPTests/SwiftCompletionTests.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,17 @@ final class SwiftCompletionTests: XCTestCase {
11481148
}
11491149

11501150
func testCompletionUsingCompileFlagsTxt() async throws {
1151+
let compileFlags =
1152+
if let defaultSDKPath {
1153+
"""
1154+
-DFOO
1155+
-sdk
1156+
\(defaultSDKPath)
1157+
"""
1158+
} else {
1159+
"-DFOO"
1160+
}
1161+
11511162
let project = try await MultiFileTestProject(
11521163
files: [
11531164
"test.swift": """
@@ -1160,7 +1171,7 @@ final class SwiftCompletionTests: XCTestCase {
11601171
print(myVar1️⃣)
11611172
}
11621173
""",
1163-
"compile_flags.txt": "-DFOO",
1174+
"compile_flags.txt": compileFlags,
11641175
]
11651176
)
11661177
let (uri, positions) = try project.openDocument("test.swift")

0 commit comments

Comments
 (0)