From d857d581040431f0bd94c75f29590270e88f7574 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Thu, 8 Dec 2016 08:26:05 -0500 Subject: [PATCH] compare: make the test output more readable Signed-off-by: Vincent Batts --- compare_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/compare_test.go b/compare_test.go index cfba566..c496915 100644 --- a/compare_test.go +++ b/compare_test.go @@ -3,6 +3,7 @@ package mtree import ( "archive/tar" "bytes" + "encoding/json" "io" "io/ioutil" "os" @@ -443,7 +444,12 @@ func TestTarCompare(t *testing.T) { } actualFailure = true - t.Logf("FAILURE: diff[%d] = %#v", i, delta) + buf, err := json.MarshalIndent(delta, "", " ") + if err == nil { + t.Logf("FAILURE: diff[%d] = %s", i, string(buf)) + } else { + t.Logf("FAILURE: diff[%d] = %#v", i, delta) + } } if actualFailure {