1
0
mirror of https://github.com/golang/go synced 2024-10-01 10:28:31 -06:00
go/internal/lsp/cmd/test/folding_range.go
Ian Cottrell 0ae87fff1b internal/lsp: fix a race in the command line tests
except the race was a symptom of a larger problem, so the fix
actually invovles cleaning up the way we run command line tests
totally to have common shared infrastructure, and also to clean up
the way we handle errors and paths into the temporary directory

Fixes: golang/go#35436
Change-Id: I4c5602607bb70e082056132baa3d4b0f8df6b13b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208269
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-11-22 16:15:56 +00:00

22 lines
512 B
Go

package cmdtest
import (
"testing"
"golang.org/x/tools/internal/span"
)
func (r *runner) FoldingRanges(t *testing.T, spn span.Span) {
goldenTag := "foldingRange-cmd"
uri := spn.URI()
filename := uri.Filename()
got, _ := r.NormalizeGoplsCmd(t, "folding_ranges", filename)
expect := string(r.data.Golden(goldenTag, filename, func() ([]byte, error) {
return []byte(got), nil
}))
if expect != got {
t.Errorf("folding_ranges failed failed for %s expected:\n%s\ngot:\n%s", filename, expect, got)
}
}