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  	"os"
    11  	"testing"
    12  )
    13  
    14  func TestBuiltin(t *testing.T) {
    15  	testenv.MustHaveGoRun(t)
    16  	t.Parallel()
    17  
    18  	old, err := os.ReadFile("builtin.go")
    19  	if err != nil {
    20  		t.Fatal(err)
    21  	}
    22  
    23  	new, err := testenv.Command(t, 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  

View as plain text