Debian Codegraph @

gopls/internal/test/integration/workspace/adhoc_test.go

raw symbols SCIP
1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package workspace
6
7 import (
8 "testing"
9
10 . "golang.org/x/tools/gopls/internal/test/integration"
11 )
12
13 // Test for golang/go#57209: editing a file in an ad-hoc package should not
14 // trigger conflicting diagnostics.
15 func TestAdhoc_Edits(t *testing.T) {
16 const files = `
17 -- a.go --
18 package foo
19
20 const X = 1
21
22 -- b.go --
23 package foo
24
25 // import "errors"
26
27 const Y = X
28 `
29
30 Run(t, files, func(t *testing.T, env *Env) {
31 env.OpenFile("b.go")
32
33 for range 10 {
34 env.RegexpReplace("b.go", `// import "errors"`, `import "errors"`)
35 env.RegexpReplace("b.go", `import "errors"`, `// import "errors"`)
36 env.AfterChange(NoDiagnostics())
37 }
38 })
39 }