1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "golang.org/x/tools/internal/lsp/protocol"
11 "golang.org/x/tools/internal/lsp/tests"
14 // A basic test for fillstruct, now that it uses a command.
15 func TestFillStruct(t *testing.T) {
30 runner.Run(t, basic, func(t *testing.T, env *Env) {
31 env.OpenFile("main.go")
32 if err := env.Editor.RefactorRewrite(env.Ctx, "main.go", &protocol.Range{
33 Start: protocol.Position{
37 End: protocol.Position{
50 Types: map[ast.Expr]types.TypeAndValue{},
51 Defs: map[*ast.Ident]types.Object{},
52 Uses: map[*ast.Ident]types.Object{},
53 Implicits: map[ast.Node]types.Object{},
54 Selections: map[*ast.SelectorExpr]*types.Selection{},
55 Scopes: map[ast.Node]*types.Scope{},
56 InitOrder: []*types.Initializer{},
60 if got := env.Editor.BufferText("main.go"); got != want {
61 t.Fatalf("TestFillStruct failed:\n%s", tests.Diff(want, got))