github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/compile/internal/gc/builtin_test.go (about)

     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  	"github.com/gagliardetto/golang-go/not-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  }