.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.1.1-0.20210319172145-bda8f5cee399 / internal / lsp / command / interface_test.go
1 // Copyright 2021 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.
4
5 package command_test
6
7 import (
8         "bytes"
9         "io/ioutil"
10         "testing"
11
12         "golang.org/x/tools/internal/lsp/command/gen"
13         "golang.org/x/tools/internal/testenv"
14 )
15
16 func TestGenerated(t *testing.T) {
17         testenv.NeedsGoBuild(t) // This is a lie. We actually need the source code.
18
19         onDisk, err := ioutil.ReadFile("command_gen.go")
20         if err != nil {
21                 t.Fatal(err)
22         }
23
24         generated, err := gen.Generate()
25         if err != nil {
26                 t.Fatal(err)
27         }
28         if !bytes.Equal(onDisk, generated) {
29                 t.Error("command_gen.go is stale -- regenerate")
30         }
31 }