Skip to content

Commit 0d9a0bf

Browse files
authored
Merge pull request #1112 from rxwei/string-processing
Handle _StringProcessing module in ExplicitModuleBuildTests
2 parents ff9682e + bbb8e2a commit 0d9a0bf

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ final class ExplicitModuleBuildTests: XCTestCase {
207207
moduleId: .swift("_Concurrency"),
208208
dependencyGraph: moduleDependencyGraph,
209209
pcmFileEncoder: pcmFileEncoder)
210+
case .relative(RelativePath("_StringProcessing.swiftmodule")):
211+
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgs,
212+
moduleId: .swift("_StringProcessing"),
213+
dependencyGraph: moduleDependencyGraph,
214+
pcmFileEncoder: pcmFileEncoder)
210215
case .relative(RelativePath("SwiftOnoneSupport.swiftmodule")):
211216
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgs,
212217
moduleId: .swift("SwiftOnoneSupport"),
@@ -376,6 +381,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
376381
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_Concurrency"),
377382
dependencyGraph: dependencyGraph,
378383
pcmFileEncoder: pcmFileEncoder)
384+
} else if pathMatchesSwiftModule(path: outputFilePath, "_StringProcessing") {
385+
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_StringProcessing"),
386+
dependencyGraph: dependencyGraph,
387+
pcmFileEncoder: pcmFileEncoder)
379388
} else if pathMatchesSwiftModule(path: outputFilePath, "SwiftOnoneSupport") {
380389
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("SwiftOnoneSupport"),
381390
dependencyGraph: dependencyGraph,
@@ -528,6 +537,10 @@ final class ExplicitModuleBuildTests: XCTestCase {
528537
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_Concurrency"),
529538
dependencyGraph: dependencyGraph,
530539
pcmFileEncoder: pcmFileEncoder)
540+
} else if pathMatchesSwiftModule(path: outputFilePath, "_StringProcessing") {
541+
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("_StringProcessing"),
542+
dependencyGraph: dependencyGraph,
543+
pcmFileEncoder: pcmFileEncoder)
531544
} else if pathMatchesSwiftModule(path: outputFilePath, "SwiftOnoneSupport") {
532545
try checkExplicitModuleBuildJob(job: job, pcmArgs: pcmArgsCurrent, moduleId: .swift("SwiftOnoneSupport"),
533546
dependencyGraph: dependencyGraph,
@@ -1013,9 +1026,14 @@ final class ExplicitModuleBuildTests: XCTestCase {
10131026
try! dependencyOracle.getImports(workingDirectory: path,
10141027
commandLine: scannerCommand)
10151028
let expectedImports = ["C", "E", "G", "Swift", "SwiftOnoneSupport"]
1016-
// Dependnig on how recent the platform we are running on, the Concurrency module may or may not be present.
1029+
// Dependnig on how recent the platform we are running on, the _Concurrency module may or may not be present.
10171030
let expectedImports2 = ["C", "E", "G", "Swift", "SwiftOnoneSupport", "_Concurrency"]
1018-
XCTAssertTrue(Set(imports.imports) == Set(expectedImports) || Set(imports.imports) == Set(expectedImports2))
1031+
// Dependnig on how recent the platform we are running on, the _StringProcessing module may or may not be present.
1032+
let expectedImports3 = ["C", "E", "G", "Swift", "SwiftOnoneSupport", "_Concurrency", "_StringProcessing"]
1033+
XCTAssertTrue(
1034+
Set(imports.imports) == Set(expectedImports) ||
1035+
Set(imports.imports) == Set(expectedImports2) ||
1036+
Set(imports.imports) == Set(expectedImports3))
10191037
}
10201038
}
10211039

@@ -1124,14 +1142,18 @@ final class ExplicitModuleBuildTests: XCTestCase {
11241142
try! dependencyOracle.getDependencies(workingDirectory: path,
11251143
commandLine: iterationCommand)
11261144

1127-
// The _Concurrency module is automatically imported in newer versions
1128-
// of the Swift compiler. If it happened to be provided, adjust
1129-
// our expectations accordingly.
1145+
// The _Concurrency and _StringProcessing modules are automatically
1146+
// imported in newer versions of the Swift compiler. If they happened to
1147+
// be provided, adjust our expectations accordingly.
11301148
let hasConcurrencyModule = dependencyGraph.modules.keys.contains {
11311149
$0.moduleName == "_Concurrency"
11321150
}
1151+
let hasStringProcessingModule = dependencyGraph.modules.keys.contains {
1152+
$0.moduleName == "_StringProcessing"
1153+
}
11331154
let adjustedExpectedNumberOfDependencies =
1134-
expectedNumberOfDependencies + (hasConcurrencyModule ? 1 : 0)
1155+
expectedNumberOfDependencies + (hasConcurrencyModule ? 1 : 0) +
1156+
(hasStringProcessingModule ? 1 : 0)
11351157

11361158
if (dependencyGraph.modules.count != adjustedExpectedNumberOfDependencies) {
11371159
lock.lock()

0 commit comments

Comments
 (0)