Skip to content

Commit f9c628b

Browse files
committed
gopls/internal/regtest: add test for bad embed rules
Updates golang/go#44342. Change-Id: I8518874fb20ae0a95f6fb2b62033e70a7d057067 Reviewed-on: https://go-review.googlesource.com/c/tools/+/295415 Trust: Heschi Kreinick <[email protected]> Run-TryBot: Heschi Kreinick <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 89a9cb6 commit f9c628b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.Await(env.DiagnosticAtRegexpWithMessage("x.go", `NONEXISTENT`, "no matching files found"))
30+
})
31+
}

0 commit comments

Comments
 (0)