1 // Copyright 2016 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 gc_test 6 7 import ( 8 "bytes" 9 "internal/testenv" 10 "io/ioutil" 11 "os/exec" 12 "testing" 13 ) 14 15 func TestBuiltin(t *testing.T) { 16 testenv.MustHaveGoRun(t) 17 18 old, err := ioutil.ReadFile("builtin.go") 19 if err != nil { 20 t.Fatal(err) 21 } 22 23 new, err := exec.Command(testenv.GoToolPath(t), "run", "mkbuiltin.go", "-stdout").Output() 24 if err != nil { 25 t.Fatal(err) 26 } 27 28 if !bytes.Equal(old, new) { 29 t.Fatal("builtin.go out of date; run mkbuiltin.go") 30 } 31 } 32