mirror of https://github.com/golang/go.git
gopls: add regtest for edit go directive quick fix
Change-Id: Id02a51b8513e11c688a1da9e7e1af66481d4881e Reviewed-on: https://go-review.googlesource.com/c/tools/+/389255 Trust: Suzy Mueller <suzmue@golang.org> Run-TryBot: Suzy Mueller <suzmue@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
4a5e7f0db6
commit
7103138b8b
|
|
@ -2185,3 +2185,33 @@ func F[T C](_ T) {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestEditGoDirective(t *testing.T) {
|
||||
testenv.NeedsGo1Point(t, 18)
|
||||
const files = `
|
||||
-- go.mod --
|
||||
module mod.com
|
||||
|
||||
go 1.16
|
||||
-- main.go --
|
||||
package main
|
||||
|
||||
func F[T any](_ T) {
|
||||
}
|
||||
`
|
||||
Run(t, files, func(t *testing.T, env *Env) { // Create a new workspace-level directory and empty file.
|
||||
var d protocol.PublishDiagnosticsParams
|
||||
env.Await(
|
||||
OnceMet(
|
||||
env.DiagnosticAtRegexpWithMessage("main.go", `T any`, "type parameters require"),
|
||||
ReadDiagnostics("main.go", &d),
|
||||
),
|
||||
)
|
||||
|
||||
env.ApplyQuickFixes("main.go", d.Diagnostics)
|
||||
|
||||
env.Await(
|
||||
EmptyDiagnostics("main.go"),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue