|
@@ -39,6 +39,7 @@ import (
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
"os"
|
|
"os"
|
|
|
"os/exec"
|
|
"os/exec"
|
|
|
|
|
+ "path/filepath"
|
|
|
"testing"
|
|
"testing"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -71,9 +72,11 @@ func TestGolden(t *testing.T) {
|
|
|
// Compute the original checksum.
|
|
// Compute the original checksum.
|
|
|
goldenSum := sum(t, "test.pb.go")
|
|
goldenSum := sum(t, "test.pb.go")
|
|
|
// Run the proto compiler.
|
|
// Run the proto compiler.
|
|
|
- run(t, "protoc", "--go_out=.", "test.proto")
|
|
|
|
|
|
|
+ run(t, "protoc", "--go_out="+os.TempDir(), "test.proto")
|
|
|
|
|
+ newFile := filepath.Join(os.TempDir(), "test.pb.go")
|
|
|
|
|
+ defer os.Remove(newFile)
|
|
|
// Compute the new checksum.
|
|
// Compute the new checksum.
|
|
|
- newSum := sum(t, "test.pb.go")
|
|
|
|
|
|
|
+ newSum := sum(t, newFile)
|
|
|
// Verify
|
|
// Verify
|
|
|
if newSum != goldenSum {
|
|
if newSum != goldenSum {
|
|
|
run(t, "hg", "diff", "test.pb.go")
|
|
run(t, "hg", "diff", "test.pb.go")
|