| 1 |
From: Anthony Fok <[email protected]> |
| 2 |
Date: Sat, 30 Dec 2023 06:17:42 -0700 |
| 3 |
Subject: Set GO111MODULE=on for TestExecute and TestCodeLens |
| 4 |
|
| 5 |
--- |
| 6 |
gopls/internal/cmd/integration_test.go | 8 ++++---- |
| 7 |
1 file changed, 4 insertions(+), 4 deletions(-) |
| 8 |
|
| 9 |
diff --git a/gopls/internal/cmd/integration_test.go b/gopls/internal/cmd/integration_test.go |
| 10 |
index 813d0bb..f49906c 100644 |
| 11 |
--- a/gopls/internal/cmd/integration_test.go |
| 12 |
+++ b/gopls/internal/cmd/integration_test.go |
| 13 |
@@ -233,7 +233,7 @@ func TestFail(t *testing.T) { t.Fatal("fail") } |
| 14 |
} |
| 15 |
// list code lenses |
| 16 |
{ |
| 17 |
|
| 18 |
+ res := goplsWithEnv(t, tree, []string{"GO111MODULE=on"}, "codelens", "./a/a_test.go") |
| 19 |
res.checkExit(true) |
| 20 |
res.checkStdout(`a_test.go:3: "run test" \[gopls.run_tests\]`) |
| 21 |
res.checkStdout(`a_test.go:4: "run test" \[gopls.run_tests\]`) |
| 22 |
@@ -246,14 +246,14 @@ func TestFail(t *testing.T) { t.Fatal("fail") } |
| 23 |
} |
| 24 |
// run the passing test |
| 25 |
{ |
| 26 |
|
| 27 |
+ res := goplsWithEnv(t, tree, []string{"GO111MODULE=on"}, "-v", "codelens", "-exec", "./a/a_test.go:3", "run test") |
| 28 |
res.checkExit(true) |
| 29 |
res.checkStderr(`PASS: TestPass`) // from go test |
| 30 |
res.checkStderr("Info: all tests passed") // from gopls.test |
| 31 |
} |
| 32 |
// run the failing test |
| 33 |
{ |
| 34 |
|
| 35 |
+ res := goplsWithEnv(t, tree, []string{"GO111MODULE=on"}, "codelens", "-exec", "./a/a_test.go:4", "run test") |
| 36 |
res.checkExit(false) |
| 37 |
res.checkStderr(`FAIL example.com/a`) |
| 38 |
res.checkStderr("Info: 1 / 1 tests failed") |
| 39 |
@@ -378,7 +378,7 @@ func TestHello(t *testing.T) { |
| 40 |
// run tests |
| 41 |
{ |
| 42 |
helloTest := "file://" + filepath.ToSlash(tree) + "/hello_test.go" |
| 43 |
|
| 44 |
+ res := goplsWithEnv(t, tree, []string{"GO111MODULE=on"}, "execute", "gopls.run_tests", `{"URI": "`+helloTest+`", "Tests": ["TestHello"]}`) |
| 45 |
res.checkExit(false) |
| 46 |
res.checkStderr(`hello_test.go:4: oops`) |
| 47 |
res.checkStderr(`1 / 1 tests failed`) |