internal/lsp: Remove 1.10 compatability in tests
Change-Id: I6e136d8b3292c1bedfdbb294c0465689ad1ffafb Reviewed-on: https://go-review.googlesource.com/c/tools/+/171239 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
681f9ce8ac
commit
2b5498619e
|
@ -1,7 +0,0 @@
|
||||||
//+build !go1.11
|
|
||||||
|
|
||||||
package lsp
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
goVersion111 = false
|
|
||||||
}
|
|
|
@ -26,10 +26,6 @@ import (
|
||||||
"golang.org/x/tools/internal/span"
|
"golang.org/x/tools/internal/span"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(rstambler): Remove this once Go 1.12 is released as we end support for
|
|
||||||
// versions of Go <= 1.10.
|
|
||||||
var goVersion111 = true
|
|
||||||
|
|
||||||
func TestLSP(t *testing.T) {
|
func TestLSP(t *testing.T) {
|
||||||
packagestest.TestAll(t, testLSP)
|
packagestest.TestAll(t, testLSP)
|
||||||
}
|
}
|
||||||
|
@ -114,10 +110,8 @@ func testLSP(t *testing.T, exporter packagestest.Exporter) {
|
||||||
|
|
||||||
t.Run("Completion", func(t *testing.T) {
|
t.Run("Completion", func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if goVersion111 { // TODO(rstambler): Remove this when we no longer support Go 1.10.
|
if len(expectedCompletions) != expectedCompletionsCount {
|
||||||
if len(expectedCompletions) != expectedCompletionsCount {
|
t.Errorf("got %v completions expected %v", len(expectedCompletions), expectedCompletionsCount)
|
||||||
t.Errorf("got %v completions expected %v", len(expectedCompletions), expectedCompletionsCount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
expectedCompletions.test(t, exported, s, completionItems)
|
expectedCompletions.test(t, exported, s, completionItems)
|
||||||
})
|
})
|
||||||
|
@ -125,10 +119,8 @@ func testLSP(t *testing.T, exporter packagestest.Exporter) {
|
||||||
t.Run("Diagnostics", func(t *testing.T) {
|
t.Run("Diagnostics", func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
diagnosticsCount := expectedDiagnostics.test(t, s.views[0])
|
diagnosticsCount := expectedDiagnostics.test(t, s.views[0])
|
||||||
if goVersion111 { // TODO(rstambler): Remove this when we no longer support Go 1.10.
|
if diagnosticsCount != expectedDiagnosticsCount {
|
||||||
if diagnosticsCount != expectedDiagnosticsCount {
|
t.Errorf("got %v diagnostics expected %v", diagnosticsCount, expectedDiagnosticsCount)
|
||||||
t.Errorf("got %v diagnostics expected %v", diagnosticsCount, expectedDiagnosticsCount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -142,50 +134,40 @@ func testLSP(t *testing.T, exporter packagestest.Exporter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if goVersion111 { // TODO(rstambler): Remove this when we no longer support Go 1.10.
|
if len(expectedFormat) != expectedFormatCount {
|
||||||
if len(expectedFormat) != expectedFormatCount {
|
t.Errorf("got %v formats expected %v", len(expectedFormat), expectedFormatCount)
|
||||||
t.Errorf("got %v formats expected %v", len(expectedFormat), expectedFormatCount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
expectedFormat.test(t, s)
|
expectedFormat.test(t, s)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Definitions", func(t *testing.T) {
|
t.Run("Definitions", func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if goVersion111 { // TODO(rstambler): Remove this when we no longer support Go 1.10.
|
if len(expectedDefinitions) != expectedDefinitionsCount {
|
||||||
if len(expectedDefinitions) != expectedDefinitionsCount {
|
t.Errorf("got %v definitions expected %v", len(expectedDefinitions), expectedDefinitionsCount)
|
||||||
t.Errorf("got %v definitions expected %v", len(expectedDefinitions), expectedDefinitionsCount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
expectedDefinitions.test(t, s, false)
|
expectedDefinitions.test(t, s, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("TypeDefinitions", func(t *testing.T) {
|
t.Run("TypeDefinitions", func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if goVersion111 { // TODO(rstambler): Remove this when we no longer support Go 1.10.
|
if len(expectedTypeDefinitions) != expectedTypeDefinitionsCount {
|
||||||
if len(expectedTypeDefinitions) != expectedTypeDefinitionsCount {
|
t.Errorf("got %v type definitions expected %v", len(expectedTypeDefinitions), expectedTypeDefinitionsCount)
|
||||||
t.Errorf("got %v type definitions expected %v", len(expectedTypeDefinitions), expectedTypeDefinitionsCount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
expectedTypeDefinitions.test(t, s, true)
|
expectedTypeDefinitions.test(t, s, true)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Highlights", func(t *testing.T) {
|
t.Run("Highlights", func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if goVersion111 { // TODO(rstambler): Remove this when we no longer support Go 1.10.
|
if len(expectedHighlights) != expectedHighlightsCount {
|
||||||
if len(expectedHighlights) != expectedHighlightsCount {
|
t.Errorf("got %v highlights expected %v", len(expectedHighlights), expectedHighlightsCount)
|
||||||
t.Errorf("got %v highlights expected %v", len(expectedHighlights), expectedHighlightsCount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
expectedHighlights.test(t, s)
|
expectedHighlights.test(t, s)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Symbols", func(t *testing.T) {
|
t.Run("Symbols", func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if goVersion111 { // TODO(rstambler): Remove this when we no longer support Go 1.10.
|
if len(expectedSymbols.m) != expectedSymbolsCount {
|
||||||
if len(expectedSymbols.m) != expectedSymbolsCount {
|
t.Errorf("got %v symbols expected %v", len(expectedSymbols.m), expectedSymbolsCount)
|
||||||
t.Errorf("got %v symbols expected %v", len(expectedSymbols.m), expectedSymbolsCount)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
expectedSymbols.test(t, s)
|
expectedSymbols.test(t, s)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue