sourcekit-lsp
sourcekit-lsp copied to clipboard
Tests inside extensions are not nested correctly in documentText/tests and workspace/tests responses
Requests to documentText/tests and workspace/tests should generate two TestItems inside a top level MyTests TestItem with the following code.
final class MyTests: XCTestCase {
func test1() {
}
}
extension MyTests {
func test2() {
}
}
Expected:
- MyTests
- test1()
- test2()
Actual:
- MyTests
- test1()
- test2()
This is the root issue for https://github.com/swift-server/vscode-swift/issues/778.
Synced to Apple’s issue tracker as rdar://127491907
A related test case with swift-testing that doesn't work with extensions; foo is ~dropped~. Correction, its not dropped but there are two root TestItems returned with the same ID:
@Suite struct TestSuite {
@Test func foo() {}
}
extension TestSuite {
@Test func bar() {}
@Test func baz() {}
}
Result:
- TestSuite
- bar
- baz