2018-04-28 13:20:38 -06:00
|
|
|
// Copyright 2018 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.
|
|
|
|
|
2018-06-13 15:17:30 -06:00
|
|
|
//+build go1.10
|
|
|
|
|
2018-04-28 13:20:38 -06:00
|
|
|
package static
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"io/ioutil"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestStaticIsUpToDate(t *testing.T) {
|
|
|
|
oldBuf, err := ioutil.ReadFile("static.go")
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("error while reading static.go: %v\n", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
newBuf, err := Generate()
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("error while generating static.go: %v\n", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if bytes.Compare(oldBuf, newBuf) != 0 {
|
2018-06-13 15:17:30 -06:00
|
|
|
t.Error(`static.go is stale. Run:
|
|
|
|
$ go generate golang.org/x/tools/godoc/static
|
|
|
|
$ git diff
|
|
|
|
to see the differences.`)
|
|
|
|
|
2018-04-28 13:20:38 -06:00
|
|
|
}
|
|
|
|
}
|