You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Normally, test modules are only dependent upon modules with
393
+
// the same basename. For example, a test module in
394
+
// 'Root/Tests/FooTests' is dependent upon 'Root/Sources/Foo'.
395
+
// Only do this if there is no explict dependency declared in manifest.
396
+
formodulein modules where module.isTest && module.dependencies.isEmpty {
397
+
iflet baseModule =modulesByName[module.basename]{
398
+
module.dependencies =[baseModule]
399
+
}
400
+
}
386
401
}
387
402
388
403
/// Private function that checks whether a module name is valid. This method doesn't return anything, but rather, if there's a problem, it throws an error describing what the problem is.
@@ -504,57 +519,8 @@ public struct PackageBuilder {
504
519
}
505
520
506
521
// Create the test modules
507
-
lettestModules=trydirectoryContents(testsPath).filter(shouldConsiderDirectory).flatMap{ dir in
522
+
returntrydirectoryContents(testsPath).filter(shouldConsiderDirectory).flatMap{ dir in
PackageBuilderTester("TestsInSources", in: fs){ result in
545
+
result.checkDiagnostic("the module at Sources/FooTests has an invalid name (\'FooTests\'): the name of a non-test module has a ‘Tests’ suffix fix: rename the module at ‘Sources/FooTests’ to not have a ‘Tests’ suffix")
546
+
}
547
+
548
+
// Normal module in Tests/
549
+
fs =InMemoryFileSystem()
550
+
try fs.createEmptyFiles("/Sources/main.swift",
551
+
"/Tests/Foo/source.swift")
552
+
PackageBuilderTester("TestsInSources", in: fs){ result in
553
+
result.checkDiagnostic("the module at Tests/Foo has an invalid name (\'Foo\'): the name of a test module has no ‘Tests’ suffix fix: rename the module at ‘Tests/Foo’ to have a ‘Tests’ suffix")
0 commit comments