Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests inside extensions are not listed correctly when parsing LSP test requests #778

Closed
adam-fowler opened this issue May 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working sourcekit-lsp SourceKit-LSP issue

Comments

@adam-fowler
Copy link
Member

The follow code should generate two TestItems inside another

final class MyTests: XCTestCase {
    func test1() {
    }
}

extension MyTests {
    func test2() {
    }
}

In the TestExplorer you should get something like this

- MyTests
  - test1()
  - test2()

Currently they are getting listed as

- MyTests
  - test1()
- test2()
@adam-fowler adam-fowler added the bug Something isn't working label May 3, 2024
@adam-fowler
Copy link
Member Author

Response to workspace/test

[Trace - 2:41:18 PM] Received response 'workspace/tests - (1)' in 415ms.
Result: [
    {
        "disabled": false,
        "tags": [],
        "style": "XCTest",
        "location": {
            "range": {
                "start": {
                    "character": 0,
                    "line": 2
                },
                "end": {
                    "character": 1,
                    "line": 5
                }
            },
            "uri": "file:///home/vscode/new-project/Tests/new-projectTests/MyTests.swift"
        },
        "label": "MyTests",
        "id": "MyTests",
        "children": [
            {
                "id": "MyTests/test1()",
                "children": [],
                "label": "test1()",
                "disabled": false,
                "style": "XCTest",
                "tags": [],
                "location": {
                    "range": {
                        "end": {
                            "character": 5,
                            "line": 4
                        },
                        "start": {
                            "character": 4,
                            "line": 3
                        }
                    },
                    "uri": "file:///home/vscode/new-project/Tests/new-projectTests/MyTests.swift"
                }
            }
        ]
    },
    {
        "disabled": false,
        "tags": [],
        "style": "XCTest",
        "location": {
            "uri": "file:///home/vscode/new-project/Tests/new-projectTests/MyTests.swift",
            "range": {
                "start": {
                    "line": 8,
                    "character": 4
                },
                "end": {
                    "line": 9,
                    "character": 5
                }
            }
        },
        "label": "test2()",
        "id": "MyTests/test2()",
        "children": []
    }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sourcekit-lsp SourceKit-LSP issue
Projects
Development

No branches or pull requests

2 participants