1 // Copyright 2020 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.
11 "golang.org/x/tools/internal/span"
14 func (r *runner) SemanticTokens(t *testing.T, spn span.Span) {
16 filename := uri.Filename()
17 got, stderr := r.NormalizeGoplsCmd(t, "semtok", filename)
19 t.Fatalf("%s: %q", filename, stderr)
21 want := string(r.data.Golden("semantic", filename, func() ([]byte, error) {
22 return []byte(got), nil
25 lwant := strings.Split(want, "\n")
26 lgot := strings.Split(got, "\n")
27 t.Errorf("want(%d-%d) != got(%d-%d) for %s", len(want), len(lwant), len(got), len(lgot), r.Normalize(filename))
28 for i := 0; i < len(lwant) && i < len(lgot); i++ {
29 if lwant[i] != lgot[i] {
30 t.Errorf("line %d:\nwant%q\ngot %q\n", i, lwant[i], lgot[i])