From 698fb76b98c46c677abe13fdc93afc6c4f38c39e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 14 Oct 2021 20:55:35 +0300 Subject: refactor --- integrationtests/fileutils.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'integrationtests/fileutils.go') 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 -- cgit v1.2.3