Source file src/cmd/compile/internal/typecheck/builtin_test.go

     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 typecheck
     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  	t.Parallel()
    18  
    19  	old, err := ioutil.ReadFile("builtin.go")
    20  	if err != nil {
    21  		t.Fatal(err)
    22  	}
    23  
    24  	new, err := exec.Command(testenv.GoToolPath(t), "run", "mkbuiltin.go", "-stdout").Output()
    25  	if err != nil {
    26  		t.Fatal(err)
    27  	}
    28  
    29  	if !bytes.Equal(old, new) {
    30  		t.Fatal("builtin.go out of date; run mkbuiltin.go")
    31  	}
    32  }
    33  

View as plain text