diff options
Diffstat (limited to 'gopls/internal/lsp/command/interface_test.go')
-rw-r--r-- | gopls/internal/lsp/command/interface_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gopls/internal/lsp/command/interface_test.go b/gopls/internal/lsp/command/interface_test.go new file mode 100644 index 000000000..e602293a1 --- /dev/null +++ b/gopls/internal/lsp/command/interface_test.go @@ -0,0 +1,31 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package command_test + +import ( + "io/ioutil" + "testing" + + "github.com/google/go-cmp/cmp" + "golang.org/x/tools/gopls/internal/lsp/command/gen" + "golang.org/x/tools/internal/testenv" +) + +func TestGenerated(t *testing.T) { + testenv.NeedsGoBuild(t) // This is a lie. We actually need the source code. + + onDisk, err := ioutil.ReadFile("command_gen.go") + if err != nil { + t.Fatal(err) + } + + generated, err := gen.Generate() + if err != nil { + t.Fatal(err) + } + if diff := cmp.Diff(string(generated), string(onDisk)); diff != "" { + t.Errorf("command_gen.go is stale -- regenerate (-generated +on disk)\n%s", diff) + } +} |