| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package misc |
| 6 |
|
| 7 |
import ( |
| 8 |
"testing" |
| 9 |
|
| 10 |
. "golang.org/x/tools/gopls/internal/test/integration" |
| 11 |
) |
| 12 |
|
| 13 |
func TestMissingPatternDiagnostic(t *testing.T) { |
| 14 |
const files = ` |
| 15 |
-- go.mod -- |
| 16 |
module example.com |
| 17 |
-- x.go -- |
| 18 |
package x |
| 19 |
|
| 20 |
import ( |
| 21 |
_ "embed" |
| 22 |
) |
| 23 |
|
| 24 |
// Issue 47436 |
| 25 |
func F() {} |
| 26 |
|
| 27 |
//go:embed NONEXISTENT |
| 28 |
var Foo string |
| 29 |
` |
| 30 |
Run(t, files, func(t *testing.T, env *Env) { |
| 31 |
env.OpenFile("x.go") |
| 32 |
env.AfterChange( |
| 33 |
Diagnostics( |
| 34 |
env.AtRegexp("x.go", `NONEXISTENT`), |
| 35 |
WithMessage("no matching files found"), |
| 36 |
), |
| 37 |
) |
| 38 |
env.RegexpReplace("x.go", `NONEXISTENT`, "x.go") |
| 39 |
env.AfterChange(NoDiagnostics(ForFile("x.go"))) |
| 40 |
}) |
| 41 |
} |