Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
bugfix: Ensure 'debug test' codelens only tests the selected test. (#…
Browse files Browse the repository at this point in the history
…1561)

If you have two functions `TestFoo` and `TestFooTwo`, and select
'debug test' on `TestFoo`, both tests will be executed. This happens
because `go test -test.run` expects a regular expression, but we were
only passing it a function name. Fixed by wrapping the function name
in start/end markers.
  • Loading branch information
kegsay authored and ramya-rao-a committed Mar 15, 2018
1 parent d2c51b6 commit 5eab209
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/goRunTestCodelens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class GoRunTestCodeLensProvider extends GoBaseCodeLensProvider {
arguments: [{ functionName: func.name }]
};

const args = ['-test.run', func.name];
const args = ['-test.run', '^' + func.name + '$'];
const program = path.dirname(document.fileName);
const env = Object.assign({}, this.debugConfig.env, vsConfig['testEnvVars']);
const envFile = vsConfig['testEnvFile'];
Expand Down

0 comments on commit 5eab209

Please sign in to comment.