github.com/v2fly/tools@v0.100.0/internal/lsp/cmd/test/highlight.go (about) 1 // Copyright 2019 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 cmdtest 6 7 import ( 8 "testing" 9 10 "fmt" 11 12 "github.com/v2fly/tools/internal/span" 13 ) 14 15 func (r *runner) Highlight(t *testing.T, spn span.Span, spans []span.Span) { 16 var expect string 17 for _, l := range spans { 18 expect += fmt.Sprintln(l) 19 } 20 expect = r.Normalize(expect) 21 22 uri := spn.URI() 23 filename := uri.Filename() 24 target := filename + ":" + fmt.Sprint(spn.Start().Line()) + ":" + fmt.Sprint(spn.Start().Column()) 25 got, _ := r.NormalizeGoplsCmd(t, "highlight", target) 26 if expect != got { 27 t.Errorf("highlight failed for %s expected:\n%s\ngot:\n%s", target, expect, got) 28 } 29 }