When having tests in an XCTestCase class in extensions in multiple files while using --enable-test-discovery building the test target fails with:
[9/12] Compiling ExamplePackageTests ExampleTests.swift /package/.build/x86_64-unknown-linux/debug/testlist.derived/ExampleTests.swift:11:16: error: invalid redeclaration of '_allTestsExampleTests' static let __allTestsExampleTests = [ ^ /package/.build/x86_64-unknown-linux/debug/testlist.derived/ExampleTests.swift:5:16: note: 'allTestsExampleTests' previously declared here static let __allTests_ExampleTests = [
The attached example can be run with docker build .
The example has a test in the class definition itself and one in an extension. But the problem also appears when having an empty class definition and tests in 2 or more extensions each in their own file.