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:
Paul Jolly 2021-04-23 15:55:50 +01:00 committed by Robert Findley
parent f946a157ee
commit a8e7c0c9c2
31 changed files with 45 additions and 35 deletions

View File

@ -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) {

View File

@ -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"
)

View File

@ -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

View File

@ -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) {

View File

@ -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 = `

View File

@ -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"
)

View File

@ -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.

View File

@ -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"

View File

@ -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"

View File

@ -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"
)

View File

@ -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

View File

@ -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"

View File

@ -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"
)

View File

@ -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) {

View File

@ -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) {

View File

@ -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"

View File

@ -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"
)

View File

@ -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)
}

View File

@ -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) {

View File

@ -7,7 +7,7 @@ package misc
import (
"testing"
. "golang.org/x/tools/gopls/internal/regtest"
. "golang.org/x/tools/internal/lsp/regtest"
)
const sharedProgram = `

View File

@ -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"

View File

@ -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 = `

View File

@ -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) {

View File

@ -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 = `

View File

@ -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

View File

@ -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,
}
}