Skip to content

Commit 91d71f6

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Peter Weinberger <[email protected]>
1 parent cf2d1e0 commit 91d71f6

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

internal/lsp/regtest/formatting_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package regtest
22

33
import (
44
"testing"
5+
6+
"golang.org/x/tools/internal/lsp/tests"
57
)
68

79
const unformattedProgram = `
@@ -33,8 +35,10 @@ func TestFormatting(t *testing.T) {
3335
})
3436
}
3537

36-
// this is the fixed case from #36824
37-
const onelineProgram = `
38+
// Tests golang/go#36824.
39+
func TestFormattingOneLine36824(t *testing.T) {
40+
41+
const onelineProgram = `
3842
-- a.go --
3943
package main; func f() {}
4044
@@ -43,8 +47,6 @@ package main
4347
4448
func f() {}
4549
`
46-
47-
func TestFormattingOneLine36824(t *testing.T) {
4850
runner.Run(t, onelineProgram, func(t *testing.T, env *Env) {
4951
env.OpenFile("a.go")
5052
env.FormatBuffer("a.go")
@@ -56,7 +58,11 @@ func TestFormattingOneLine36824(t *testing.T) {
5658
})
5759
}
5860

59-
const onelineProgramA = `
61+
// Tests golang/go#36824.
62+
func TestFormattingOneLineImports36824(t *testing.T) {
63+
t.Skipf("golang/go#36824 has not been fixed yet")
64+
65+
const onelineProgramA = `
6066
-- a.go --
6167
package x; func f() {fmt.Println()}
6268
@@ -67,18 +73,13 @@ import "fmt"
6773
6874
func f() { fmt.Println() }
6975
`
70-
71-
// this is the example from #36824 done properly
72-
// but gopls does not reformat before fixing the imports
73-
func TestFormattingOneLineImports36824(t *testing.T) {
7476
runner.Run(t, onelineProgramA, func(t *testing.T, env *Env) {
7577
env.OpenFile("a.go")
76-
env.FormatBuffer("a.go")
7778
env.OrganizeImports("a.go")
7879
got := env.Editor.BufferText("a.go")
7980
want := env.ReadWorkspaceFile("a.go.imported")
8081
if got != want {
81-
t.Errorf("OneLineImports go\n%q wanted\n%q", got, want)
82+
t.Errorf("OneLineImports:\n%s", tests.Diff(want, got))
8283
}
8384
})
8485
}

internal/lsp/regtest/unix_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package regtest
88

99
import (
10-
"fmt"
1110
"testing"
1211

1312
"golang.org/x/tools/internal/lsp/fake"
@@ -31,6 +30,6 @@ func _() {
3130
t.Fatal(err)
3231
}
3332
}, WithEditorConfig(fake.EditorConfig{
34-
Env: []string{fmt.Sprintf("GOPATH=:/path/to/gopath")},
33+
Env: []string{"GOPATH=:/path/to/gopath"},
3534
}))
3635
}

0 commit comments

Comments
 (0)