1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 (
"bytes"
"io/ioutil"
"testing"
"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 !bytes.Equal(onDisk, generated) {
t.Error("command_gen.go is stale -- regenerate")
}
}
|