mirror of
https://github.com/golang/go
synced 2024-11-06 05:26:11 -07:00
f79515f338
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>
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package gopls_test
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"golang.org/x/tools/go/packages/packagestest"
|
|
"golang.org/x/tools/gopls/internal/hooks"
|
|
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/testenv"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
testenv.ExitIfSmallMachine()
|
|
os.Exit(m.Run())
|
|
}
|
|
|
|
func TestCommandLine(t *testing.T) {
|
|
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) {
|
|
const testdata = "../../internal/lsp/testdata"
|
|
if stat, err := os.Stat(testdata); err != nil || !stat.IsDir() {
|
|
t.Skip("testdata directory not present")
|
|
}
|
|
data := tests.Load(t, exporter, testdata)
|
|
defer data.Exported.Cleanup()
|
|
tests.Run(t, cmdtest.NewRunner(exporter, data, tests.Context(t), commandLineOptions), data)
|
|
}
|