github.com/april1989/origin-go-tools@v0.0.32/internal/lsp/cmd/test/highlight.go (about)

     1  package cmdtest
     2  
     3  import (
     4  	"testing"
     5  
     6  	"fmt"
     7  
     8  	"github.com/april1989/origin-go-tools/internal/span"
     9  )
    10  
    11  func (r *runner) Highlight(t *testing.T, spn span.Span, spans []span.Span) {
    12  	var expect string
    13  	for _, l := range spans {
    14  		expect += fmt.Sprintln(l)
    15  	}
    16  	expect = r.Normalize(expect)
    17  
    18  	uri := spn.URI()
    19  	filename := uri.Filename()
    20  	target := filename + ":" + fmt.Sprint(spn.Start().Line()) + ":" + fmt.Sprint(spn.Start().Column())
    21  	got, _ := r.NormalizeGoplsCmd(t, "highlight", target)
    22  	if expect != got {
    23  		t.Errorf("highlight failed for %s expected:\n%s\ngot:\n%s", target, expect, got)
    24  	}
    25  }