Uploaded image for project: 'Swift'
  1. Swift
  2. SR-11951

Test discovery on Linux breaks with test class extensions in multiple files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Package Manager, XCTest
    • Labels:
      None
    • Environment:

      (Ubuntu) Linux

      Docker image swift:5.1

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              siemensikkema Siemen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: