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

add test running support #72

Closed
wants to merge 5 commits into from
Closed

Conversation

star-tek-mb
Copy link

@star-tek-mb star-tek-mb commented Nov 11, 2022

Utilizes zig test command.

  • single test running
  • tests discovery

Differences from #57 is i am using vscode.TestController API.

I think it still has some issues, but i dont know how to solve them.

For example, if you have:

test "read" {
...
}

test "read struct" {
...
}

And you are running zig test file.zig --test-filter read - you will execute both tests.

Also, test runner is very slow i think (if you run multiple tests). Or is it supposed to be like that?

@Vexu
Copy link
Member

Vexu commented Nov 11, 2022

This does seem to work when opening a file with a test for the first time but removing the test or adding a new one does not get picked up until the window is reloaded.

And you are running zig test file.zig --test-filter read - you will execute both tests.

I don't think there is a solution for that besides copying the entire file into a temporary file and commenting out all other tests but that would probably cause other issues.

You could make a proposal for making --test-filter more specific by for example including a file name and line somehow.

@star-tek-mb
Copy link
Author

This does seem to work when opening a file with a test for the first time but removing the test or adding a new one does not get picked up until the window is reloaded.

I see. There is a manual refresh button that i fixed. But i also need to fix a document when onChangeDocument event happens, i guess. I will investigate.

@star-tek-mb
Copy link
Author

I will wait for single test running in zig test cli. And will reopen pr.

@Vexu
Copy link
Member

Vexu commented Apr 6, 2024

This should be possible now with ziglang/zig#19079 making test names fully qualified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants