internal/lsp/regtest: add a t.Skip for golang/go#36824 regtest
Switching to using a t.Skip means we are more likely to remember to
actually re-enable the test at some point.
Also picked up a staticcheck fix along the way.
Change-Id: I382eaa8d204bee74a7ff46e8a1b11dab567b83ae
Reviewed-on: https://go-review.googlesource.com/c/tools/+/234757
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
diff --git a/internal/lsp/regtest/formatting_test.go b/internal/lsp/regtest/formatting_test.go
index a2e83b3..18b3da0 100644
--- a/internal/lsp/regtest/formatting_test.go
+++ b/internal/lsp/regtest/formatting_test.go
@@ -2,6 +2,8 @@
import (
"testing"
+
+ "golang.org/x/tools/internal/lsp/tests"
)
const unformattedProgram = `
@@ -33,8 +35,10 @@
})
}
-// this is the fixed case from #36824
-const onelineProgram = `
+// Tests golang/go#36824.
+func TestFormattingOneLine36824(t *testing.T) {
+
+ const onelineProgram = `
-- a.go --
package main; func f() {}
@@ -43,8 +47,6 @@
func f() {}
`
-
-func TestFormattingOneLine36824(t *testing.T) {
runner.Run(t, onelineProgram, func(t *testing.T, env *Env) {
env.OpenFile("a.go")
env.FormatBuffer("a.go")
@@ -56,7 +58,11 @@
})
}
-const onelineProgramA = `
+// Tests golang/go#36824.
+func TestFormattingOneLineImports36824(t *testing.T) {
+ t.Skipf("golang/go#36824 has not been fixed yet")
+
+ const onelineProgramA = `
-- a.go --
package x; func f() {fmt.Println()}
@@ -67,18 +73,13 @@
func f() { fmt.Println() }
`
-
-// this is the example from #36824 done properly
-// but gopls does not reformat before fixing the imports
-func TestFormattingOneLineImports36824(t *testing.T) {
runner.Run(t, onelineProgramA, func(t *testing.T, env *Env) {
env.OpenFile("a.go")
- env.FormatBuffer("a.go")
env.OrganizeImports("a.go")
got := env.Editor.BufferText("a.go")
want := env.ReadWorkspaceFile("a.go.imported")
if got != want {
- t.Errorf("OneLineImports go\n%q wanted\n%q", got, want)
+ t.Errorf("OneLineImports:\n%s", tests.Diff(want, got))
}
})
}
diff --git a/internal/lsp/regtest/unix_test.go b/internal/lsp/regtest/unix_test.go
index 91638e2..c75bc4e 100644
--- a/internal/lsp/regtest/unix_test.go
+++ b/internal/lsp/regtest/unix_test.go
@@ -7,7 +7,6 @@
package regtest
import (
- "fmt"
"testing"
"golang.org/x/tools/internal/lsp/fake"
@@ -31,6 +30,6 @@
t.Fatal(err)
}
}, WithEditorConfig(fake.EditorConfig{
- Env: []string{fmt.Sprintf("GOPATH=:/path/to/gopath")},
+ Env: []string{"GOPATH=:/path/to/gopath"},
}))
}