From 4b30573d95ac33bf905da741f1a4bb38b00a2f3f Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Tue, 18 Mar 2025 09:45:22 -0700 Subject: [PATCH] Set `-sdk` in `testCompletionUsingCompileFlagsTxt` Otherwise this test fails when run using an Xcode toolchain (instead of an open source toolchain). --- Tests/SourceKitLSPTests/SwiftCompletionTests.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Tests/SourceKitLSPTests/SwiftCompletionTests.swift b/Tests/SourceKitLSPTests/SwiftCompletionTests.swift index fc296dd4..26cd1628 100644 --- a/Tests/SourceKitLSPTests/SwiftCompletionTests.swift +++ b/Tests/SourceKitLSPTests/SwiftCompletionTests.swift @@ -1148,6 +1148,17 @@ final class SwiftCompletionTests: XCTestCase { } func testCompletionUsingCompileFlagsTxt() async throws { + let compileFlags = + if let defaultSDKPath { + """ + -DFOO + -sdk + \(defaultSDKPath) + """ + } else { + "-DFOO" + } + let project = try await MultiFileTestProject( files: [ "test.swift": """ @@ -1160,7 +1171,7 @@ final class SwiftCompletionTests: XCTestCase { print(myVar1️⃣) } """, - "compile_flags.txt": "-DFOO", + "compile_flags.txt": compileFlags, ] ) let (uri, positions) = try project.openDocument("test.swift")