mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
gopls: control features for command line tests
A general mechanism for modifying the features in command line tests Use it to turn of go-diff for now Fixes golang/go#35392 Change-Id: Ie79723e94fb14fcde1e98709a63f44046e101bc4 Reviewed-on: https://go-review.googlesource.com/c/tools/+/205739 Run-TryBot: Ian Cottrell <iancottrell@google.com> Reviewed-by: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
c2ac6c2a2d
commit
f79515f338
@ -11,6 +11,7 @@ import (
|
|||||||
"golang.org/x/tools/go/packages/packagestest"
|
"golang.org/x/tools/go/packages/packagestest"
|
||||||
"golang.org/x/tools/gopls/internal/hooks"
|
"golang.org/x/tools/gopls/internal/hooks"
|
||||||
cmdtest "golang.org/x/tools/internal/lsp/cmd/test"
|
cmdtest "golang.org/x/tools/internal/lsp/cmd/test"
|
||||||
|
"golang.org/x/tools/internal/lsp/source"
|
||||||
"golang.org/x/tools/internal/lsp/tests"
|
"golang.org/x/tools/internal/lsp/tests"
|
||||||
"golang.org/x/tools/internal/testenv"
|
"golang.org/x/tools/internal/testenv"
|
||||||
)
|
)
|
||||||
@ -24,6 +25,12 @@ func TestCommandLine(t *testing.T) {
|
|||||||
packagestest.TestAll(t, testCommandLine)
|
packagestest.TestAll(t, testCommandLine)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func commandLineOptions(options *source.Options) {
|
||||||
|
options.StaticCheck = true
|
||||||
|
options.GoDiff = false
|
||||||
|
hooks.Options(options)
|
||||||
|
}
|
||||||
|
|
||||||
func testCommandLine(t *testing.T, exporter packagestest.Exporter) {
|
func testCommandLine(t *testing.T, exporter packagestest.Exporter) {
|
||||||
const testdata = "../../internal/lsp/testdata"
|
const testdata = "../../internal/lsp/testdata"
|
||||||
if stat, err := os.Stat(testdata); err != nil || !stat.IsDir() {
|
if stat, err := os.Stat(testdata); err != nil || !stat.IsDir() {
|
||||||
@ -31,5 +38,5 @@ func testCommandLine(t *testing.T, exporter packagestest.Exporter) {
|
|||||||
}
|
}
|
||||||
data := tests.Load(t, exporter, testdata)
|
data := tests.Load(t, exporter, testdata)
|
||||||
defer data.Exported.Cleanup()
|
defer data.Exported.Cleanup()
|
||||||
tests.Run(t, cmdtest.NewRunner(exporter, data, tests.Context(t), hooks.Options), data)
|
tests.Run(t, cmdtest.NewRunner(exporter, data, tests.Context(t), commandLineOptions), data)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user