Debian Codegraph @

gopls/internal/test/integration/misc/embed_test.go

raw symbols SCIP
1 // Copyright 2021 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 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 }