Description
Describe the bug
When the code len of a subtest suite is called, it ends up causing an incorrect parse of the function, thus not properly generating the test command. It results in something like:
go test -timeout 30s -coverprofile=/tmp/vscode-xxx/go-code-cover -run ^\(\*testSuite\)\.TestSuite_Example$/^Success$ test
The expected output would be something like:
go test -timeout 30s -coverprofile=/tmp/vscode-xxx/go-code-cover -run ^TestSuite$ -m ^(TestSuite_Example$/^Success)$ test
This is happening due to escaping both the function name and the subtest name in this line:
vscode-go/extension/src/subTestUtils.ts
Lines 17 to 23 in 77a4fdb
Escaping only the second part would already solve the problem:
https://github.com/caioreix/vscode-go/blob/6061299ff2b1526292a9e1aeff77bf77b3f88f67/extension/src/subTestUtils.ts#L17-L25
Steps to reproduce the behavior:
To reproduce it, you can use the snippet below and click on the codelens 'run test' corresponding to the Success or Fail subtest (I used testify to make visualization easier, but the behavior is the same for any test suite):
package main
import (
"testing"
"github.com/stretchr/testify/suite"
)
type testSuite struct {
suite.Suite
}
func TestSuite(t *testing.T) {
suite.Run(t, new(testSuite))
}
func (t *testSuite) TestSuite_Example() {
t.Run("Success", func() {})
t.Run("Fail", func() {})
}