gopls/internal/regtest: handle flake in TestCRLF

Make the test a little more stable by making sure diagnostics complete
before organizing imports in these tests.

Change-Id: Id23341569207878554902887498632d6f1ce56cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/271628
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Rebecca Stambler 2020-11-19 13:40:25 -05:00
Родитель 0557df368a
Коммит be796f87a6
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -4,6 +4,7 @@ import (
"strings"
"testing"
"golang.org/x/tools/internal/lsp"
"golang.org/x/tools/internal/lsp/tests"
)
@ -174,6 +175,7 @@ func Hi() {
`
crlf := strings.ReplaceAll(want, "\n", "\r\n")
env.CreateBuffer("main.go", crlf)
env.Await(CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 1))
env.SaveBuffer("main.go")
got := env.Editor.BufferText("main.go")
if want != got {
@ -212,6 +214,7 @@ func main() {
`
crlf := strings.ReplaceAll(want, "\n", "\r\n")
env.CreateBuffer("main.go", crlf)
env.Await(CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 1))
env.OrganizeImports("main.go")
got := env.Editor.BufferText("main.go")
got = strings.ReplaceAll(got, "\r\n", "\n") // convert everything to LF for simplicity