mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
This change makes sure that tests are run with the correct version of the go tool. The correct version is the one that we invoked with "go test", not the one that is first in our path. Fixes #16577 Change-Id: If22c8f8c3ec9e7c35d094362873819f2fbb8559b Reviewed-on: https://go-review.googlesource.com/28089 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
31 lines
608 B
Go
31 lines
608 B
Go
// Copyright 2016 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 gc_test
|
|
|
|
import (
|
|
"bytes"
|
|
"internal/testenv"
|
|
"io/ioutil"
|
|
"os/exec"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuiltin(t *testing.T) {
|
|
testenv.MustHaveGoRun(t)
|
|
|
|
old, err := ioutil.ReadFile("builtin.go")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
new, err := exec.Command(testenv.GoToolPath(t), "run", "mkbuiltin.go", "-stdout").Output()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if !bytes.Equal(old, new) {
|
|
t.Fatal("builtin.go out of date; run mkbuiltin.go")
|
|
}
|
|
}
|