Skip to content

Commit 3544e8c

Browse files
committed
internal/lsp/regtest: add a regtest for golang/go#39296
Looks like the issue described in golang/go#39296 (comment) is resolved with Go 1.15. Fixes golang/go#39296 Change-Id: Ibe694281d4d4d40df3dc7bacc5837f593bb1dc5a Reviewed-on: https://go-review.googlesource.com/c/tools/+/241398 Run-TryBot: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent 31b9a74 commit 3544e8c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

internal/lsp/regtest/diagnostics_test.go

+39
Original file line numberDiff line numberDiff line change
@@ -954,3 +954,42 @@ func _() {
954954
)
955955
}, WithoutWorkspaceFolders())
956956
}
957+
958+
// Reproduces the case described in
959+
// https://github.com/golang/go/issues/39296#issuecomment-652058883.
960+
func TestPkgm(t *testing.T) {
961+
const basic = `
962+
-- go.mod --
963+
module mod.com
964+
965+
go 1.15
966+
-- foo/foo.go --
967+
package foo
968+
969+
import "fmt"
970+
971+
func Foo() {
972+
fmt.Println("")
973+
}
974+
`
975+
runner.Run(t, basic, func(t *testing.T, env *Env) {
976+
testenv.NeedsGo1Point(t, 15)
977+
978+
env.Await(
979+
CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromInitialWorkspaceLoad), 1),
980+
)
981+
env.WriteWorkspaceFile("foo/foo_test.go", `package main
982+
983+
func main() {
984+
985+
}`)
986+
env.OpenFile("foo/foo_test.go")
987+
env.RegexpReplace("foo/foo_test.go", `package main`, `package foo`)
988+
env.Await(
989+
OnceMet(
990+
CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidChange), 1),
991+
NoDiagnostics("foo/foo.go"),
992+
),
993+
)
994+
})
995+
}

0 commit comments

Comments
 (0)