github.com/0xKiwi/rules_go@v0.24.3/tests/core/go_binary/stamp_test.go (about) 1 package main 2 3 import ( 4 "os/exec" 5 "strings" 6 "testing" 7 8 "github.com/bazelbuild/rules_go/go/tools/bazel" 9 ) 10 11 func TestStamp(t *testing.T) { 12 bin, ok := bazel.FindBinary("tests/core/go_binary", "stamp_bin") 13 if !ok { 14 t.Error("could not find stamp_bin") 15 } 16 out, err := exec.Command(bin).Output() 17 if err != nil { 18 t.Fatal(err) 19 } 20 21 got := strings.TrimSpace(string(out)) 22 want := `Bin=Bin 23 Embed=Embed 24 DepSelf=DepSelf 25 DepBin=DepBin` 26 if got != want { 27 t.Errorf("got:\n%s\nwant:\n%s", got, want) 28 } 29 }