Skip to content

Commit 7c89c52

Browse files
committed
x/tools/gopls: add a skipped test for renaming of package
This adds a test that asserts that gopls gracefully recovers from a bad package name. It does not include the fix for the test, and so this test is skipped: I took a stab at it but it was a deep spelunk that I wasn't able to make enough progress on. Updates golang/go#41061 Change-Id: I86d817396dae5b0211e633721867e811c7d6cf40 Reviewed-on: https://go-review.googlesource.com/c/tools/+/262019 Run-TryBot: Jean de Klerk <deklerk@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Jean de Klerk <deklerk@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
1 parent c901190 commit 7c89c52

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

gopls/internal/regtest/diagnostics_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,3 +1427,28 @@ func main() {
14271427
)
14281428
})
14291429
}
1430+
1431+
// When foo_test.go is opened, gopls will object to the borked package name.
1432+
// This test asserts that when the package name is fixed, gopls will soon after
1433+
// have no more complaints about it.
1434+
// https://github.com/golang/go/issues/41061
1435+
func TestRenamePackage(t *testing.T) {
1436+
t.Skip("Waiting for the fix that makes this pass: https://github.com/golang/go/issues/41061")
1437+
1438+
const contents = `
1439+
-- go.mod --
1440+
module mod.com
1441+
-- foo.go --
1442+
package foo
1443+
-- foo_test.go --
1444+
package foo_`
1445+
1446+
runner.Run(t, contents, func(t *testing.T, env *Env) {
1447+
env.OpenFile("foo_test.go")
1448+
env.RegexpReplace("foo_test.go", "foo_", "foo_test")
1449+
env.SaveBuffer("foo_test.go")
1450+
env.Await(
1451+
EmptyDiagnostics("foo_test.go"),
1452+
)
1453+
})
1454+
}

0 commit comments

Comments
 (0)