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

Command to run unit test under cursor or re-run previous test #1508

Closed
mislav opened this issue May 18, 2021 · 1 comment
Closed

Command to run unit test under cursor or re-run previous test #1508

mislav opened this issue May 18, 2021 · 1 comment

Comments

@mislav
Copy link
Contributor

mislav commented May 18, 2021

Is your feature request related to a problem? Please describe.
The Go: Test Function At Cursor command is great, but running it repeatedly stops being useful as soon as I switch to the implementation or to another piece of code in the _test.go file which isn't under a test function. At this point I have to switch to the Go: Test Previous command to keep re-running the test I'm interested in. Mentally keeping track of where I am in my code so I can activate either the first command or the second command can be exhausting and error prone.

Describe the solution you'd like
A new command to:

  • run the test function at cursor, if one exists;
  • otherwise, re-run previous test.

Describe alternatives you've considered
I've bound a single keyboard shortcut for the Go: Test Function At Cursor command when I'm in _test.go files and the Go: Test Previous command when in regular .go files. This covers switching between test and implementation, but doesn't handle the case when the cursor is in a _test.go file but not under any test function.

@gopherbot
Copy link
Collaborator

Change https://golang.org/cl/320769 mentions this issue: src/goTest: Add command Test Function At Cursor or Test Previous

@golang golang locked and limited conversation to collaborators May 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants