.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools / gopls@v0.6.9 / internal / regtest / misc / embed_test.go
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 package misc
5
6 import (
7         "testing"
8
9         . "golang.org/x/tools/gopls/internal/regtest"
10         "golang.org/x/tools/internal/testenv"
11 )
12
13 func TestMissingPatternDiagnostic(t *testing.T) {
14         testenv.NeedsGo1Point(t, 16)
15         const files = `
16 -- go.mod --
17 module example.com
18 -- x.go --
19 package x
20
21 import (
22         _ "embed"
23 )
24
25 //go:embed NONEXISTENT
26 var foo string
27 `
28         Run(t, files, func(t *testing.T, env *Env) {
29                 env.OpenFile("x.go")
30                 env.Await(env.DiagnosticAtRegexpWithMessage("x.go", `NONEXISTENT`, "no matching files found"))
31                 env.RegexpReplace("x.go", `NONEXISTENT`, "x.go")
32                 env.Await(EmptyDiagnostics("x.go"))
33         })
34 }