mirror of https://github.com/golang/go.git
internal/lsp: move gopls/internal/regtest -> internal/lsp/regtest
Note: this only moves the regtest framework, not the gopls regtest tests. Change-Id: Ia70d2e97df8a8bd48a042e5b037c1e56a210b594 Reviewed-on: https://go-review.googlesource.com/c/tools/+/312412 Trust: Paul Jolly <paul@myitcv.org.uk> Run-TryBot: Paul Jolly <paul@myitcv.org.uk> gopls-CI: kokoro <noreply+kokoro@google.com> Reviewed-by: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
parent
f946a157ee
commit
a8e7c0c9c2
|
|
@ -9,13 +9,14 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
Main(m)
|
||||
Main(m, hooks.Options)
|
||||
}
|
||||
|
||||
func printBenchmarkResults(result testing.BenchmarkResult) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
)
|
||||
|
||||
// Pilosa is a repository that has historically caused significant memory
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/command"
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
|
|
@ -20,7 +21,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
Main(m)
|
||||
Main(m, hooks.Options)
|
||||
}
|
||||
|
||||
func TestDisablingCodeLens(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
|
|
@ -17,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
Main(m)
|
||||
Main(m, hooks.Options)
|
||||
}
|
||||
|
||||
const proxy = `
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
"golang.org/x/tools/internal/lsp/source"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ import (
|
|||
"log"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp"
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
|
|
@ -19,7 +20,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
Main(m)
|
||||
Main(m, hooks.Options)
|
||||
}
|
||||
|
||||
// Use mod.com for all go.mod files due to golang/go#35230.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
"golang.org/x/tools/internal/lsp/tests"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
)
|
||||
|
||||
// This test passes (TestHoverOnError in definition_test.go) without
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
"golang.org/x/tools/internal/lsp/tests"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/tests"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
)
|
||||
|
||||
func TestGenerateProgress(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
)
|
||||
|
||||
func TestWorkspacePackageHighlight(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
"golang.org/x/tools/internal/lsp/regtest"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
regtest.Main(m)
|
||||
regtest.Main(m, hooks.Options)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
)
|
||||
|
||||
func TestStdlibReferences(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
)
|
||||
|
||||
const sharedProgram = `
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package misc
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
"golang.org/x/tools/internal/lsp/tests"
|
||||
|
|
@ -17,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
Main(m)
|
||||
Main(m, hooks.Options)
|
||||
}
|
||||
|
||||
const workspaceProxy = `
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ package regtest
|
|||
import (
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
"golang.org/x/tools/internal/lsp/protocol"
|
||||
|
|
@ -15,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
Main(m)
|
||||
Main(m, hooks.Options)
|
||||
}
|
||||
|
||||
func TestEditFile(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
. "golang.org/x/tools/gopls/internal/regtest"
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
. "golang.org/x/tools/internal/lsp/regtest"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/command"
|
||||
"golang.org/x/tools/internal/lsp/fake"
|
||||
|
|
@ -21,7 +22,7 @@ import (
|
|||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
Main(m)
|
||||
Main(m, hooks.Options)
|
||||
}
|
||||
|
||||
const workspaceProxy = `
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import (
|
|||
"time"
|
||||
|
||||
"golang.org/x/tools/internal/lsp/cmd"
|
||||
"golang.org/x/tools/internal/lsp/source"
|
||||
"golang.org/x/tools/internal/testenv"
|
||||
"golang.org/x/tools/internal/tool"
|
||||
)
|
||||
|
|
@ -83,7 +84,7 @@ func DefaultModes() Mode {
|
|||
}
|
||||
|
||||
// Main sets up and tears down the shared regtest state.
|
||||
func Main(m *testing.M) {
|
||||
func Main(m *testing.M, hook func(*source.Options)) {
|
||||
testenv.ExitIfSmallMachine()
|
||||
|
||||
flag.Parse()
|
||||
|
|
@ -97,6 +98,7 @@ func Main(m *testing.M) {
|
|||
Timeout: *regtestTimeout,
|
||||
PrintGoroutinesOnFailure: *printGoroutinesOnFailure,
|
||||
SkipCleanup: *skipCleanup,
|
||||
OptionsHook: hook,
|
||||
}
|
||||
if *runSubprocessTests {
|
||||
goplsPath := *goplsBinaryPath
|
||||
|
|
@ -21,7 +21,6 @@ import (
|
|||
|
||||
exec "golang.org/x/sys/execabs"
|
||||
|
||||
"golang.org/x/tools/gopls/internal/hooks"
|
||||
"golang.org/x/tools/internal/jsonrpc2"
|
||||
"golang.org/x/tools/internal/jsonrpc2/servertest"
|
||||
"golang.org/x/tools/internal/lsp/cache"
|
||||
|
|
@ -60,6 +59,7 @@ type Runner struct {
|
|||
PrintGoroutinesOnFailure bool
|
||||
TempDir string
|
||||
SkipCleanup bool
|
||||
OptionsHook func(*source.Options)
|
||||
|
||||
mu sync.Mutex
|
||||
ts *servertest.TCPServer
|
||||
|
|
@ -84,7 +84,7 @@ func (r *Runner) defaultConfig() *runConfig {
|
|||
return &runConfig{
|
||||
modes: r.DefaultModes,
|
||||
timeout: r.Timeout,
|
||||
optionsHook: hooks.Options,
|
||||
optionsHook: r.OptionsHook,
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue