Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / internal / lsp / source / genapijson / generate_test.go
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.
4
5 package main
6
7 import (
8         "bytes"
9         "io/ioutil"
10         "testing"
11
12         "golang.org/x/tools/internal/testenv"
13 )
14
15 func TestGenerate(t *testing.T) {
16         testenv.NeedsGoBuild(t) // This is a lie. We actually need the source code.
17         testenv.NeedsGoPackages(t)
18
19         got, err := ioutil.ReadFile("../api_json.go")
20         if err != nil {
21                 t.Fatal(err)
22         }
23         want, err := generate()
24         if err != nil {
25                 t.Fatal(err)
26         }
27         if !bytes.Equal(got, want) {
28                 t.Error("api_json is out of sync. Run `go generate ./internal/lsp/source` from the root of tools.")
29         }
30 }