mirror of
https://github.com/golang/go
synced 2024-11-18 05:44:47 -07:00
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>
This commit is contained in:
parent
cf2d1e09c8
commit
91d71f6c2f
@ -2,6 +2,8 @@ package regtest
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/tests"
|
||||
)
|
||||
|
||||
const unformattedProgram = `
|
||||
@ -33,7 +35,9 @@ func TestFormatting(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// this is the fixed case from #36824
|
||||
// Tests golang/go#36824.
|
||||
func TestFormattingOneLine36824(t *testing.T) {
|
||||
|
||||
const onelineProgram = `
|
||||
-- a.go --
|
||||
package main; func f() {}
|
||||
@ -43,8 +47,6 @@ package main
|
||||
|
||||
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,6 +58,10 @@ func TestFormattingOneLine36824(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// 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 @@ import "fmt"
|
||||
|
||||
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))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
package regtest
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
@ -31,6 +30,6 @@ func _() {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}, WithEditorConfig(fake.EditorConfig{
|
||||
Env: []string{fmt.Sprintf("GOPATH=:/path/to/gopath")},
|
||||
Env: []string{"GOPATH=:/path/to/gopath"},
|
||||
}))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user