swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.29k stars 272 forks source link

Test functions in classes extending XCTestSuite erroneously included as tests #1694

Open plemarquand opened 2 hours ago

plemarquand commented 2 hours ago

Swift version

swiftlang-6.0.0.9.10

Platform

macOS 15.0

Editor

VS Code

Does the issue reproduce with Swift 6?

Yes

Description

When a class in a test target inherits from XCTestSuite, not XCTestCase, methods inside of it that match the naming convention of tests are erroneously returned as tests in the workspace/tests and textDocument/tests requests.

Steps to Reproduce

The following code reports both Suite and testFoo as something that can be run, but doing swift test --filter TestTarget.Suite/testFoo$ results in no tests being run.

class Suite: XCTestSuite {
    func testFoo() {}
}

Logging

No response

ahoppen commented 2 hours ago

Synced to Apple’s issue tracker as rdar://136362710