diff options
| author | Paul Buetow <paul@buetow.org> | 2021-10-14 20:55:35 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-10-15 08:40:54 +0300 |
| commit | 698fb76b98c46c677abe13fdc93afc6c4f38c39e (patch) | |
| tree | ac6884ea24d262c36d1f3b6e12a6adf2ba7acb8b /integrationtests/fileutils.go | |
| parent | 06ece112c0dd20c0c211c538216fe64ebe4045c9 (diff) | |
refactor
Diffstat (limited to 'integrationtests/fileutils.go')
| -rw-r--r-- | integrationtests/fileutils.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/integrationtests/fileutils.go b/integrationtests/fileutils.go index 8ab66a0..1a55732 100644 --- a/integrationtests/fileutils.go +++ b/integrationtests/fileutils.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "os/exec" + "strings" "testing" ) @@ -78,10 +79,12 @@ func compareFiles(t *testing.T, fileA, fileB string) error { shaFileB := shaOfFile(t, fileB) if shaFileA != shaFileB { - t.Errorf("Expected SHA %s but got %s", shaFileA, shaFileB) + var sb strings.Builder + sb.WriteString(fmt.Sprintf("Expected SHA %s but got %s:\n", shaFileA, shaFileB)) if bytes, err := exec.Command("diff", "-u", fileA, fileB).Output(); err != nil { - return fmt.Errorf(string(bytes)) + sb.Write(bytes) } + return fmt.Errorf(sb.String()) } return nil |
