Skip to content

Commit 3b9dd49

Browse files
[Tests] Don't use invalid module to satisfy canImport check (swiftlang#7647)
Stop using a fake invalid module to satisfy `canImport` check for testing as swift compiler will start to evaluate such checks to false in the future. Instead, using a valid swift interfacefile to satisify the external module import dependency.
1 parent ee9d0b2 commit 3b9dd49

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tests/SPMBuildCoreTests/PluginInvocationTests.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,11 +1043,14 @@ final class PluginInvocationTests: XCTestCase {
10431043
}
10441044
""")
10451045

1046-
// Create something that looks like another module that can be detected via `canImport()`.
1046+
// Create a valid swift interface file that can be detected via `canImport()`.
10471047
let fakeExtraModulesDir = tmpPath.appending("ExtraModules")
10481048
try localFileSystem.createDirectory(fakeExtraModulesDir, recursive: true)
1049-
let fakeExtraModuleFile = fakeExtraModulesDir.appending("ModuleFoundViaExtraSearchPaths.swiftmodule")
1050-
try localFileSystem.writeFileContents(fakeExtraModuleFile, string: "")
1049+
let fakeExtraModuleFile = fakeExtraModulesDir.appending("ModuleFoundViaExtraSearchPaths.swiftinterface")
1050+
try localFileSystem.writeFileContents(fakeExtraModuleFile, string: """
1051+
// swift-interface-format-version: 1.0
1052+
// swift-module-flags: -module-name ModuleFoundViaExtraSearchPaths
1053+
""")
10511054

10521055
/////////
10531056
// Load a workspace from the package.

0 commit comments

Comments
 (0)