From ba18026d0d340cfef79c987d3ba82d23f358aee9 Mon Sep 17 00:00:00 2001 From: Sebastian Dahlgren Date: Tue, 17 Nov 2020 05:50:13 +0100 Subject: [PATCH] Revert "Do not escape JSON" --- v2/assertions.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/v2/assertions.go b/v2/assertions.go index f05b2ac..ab3901d 100644 --- a/v2/assertions.go +++ b/v2/assertions.go @@ -61,18 +61,14 @@ func (g *Goldie) Assert(t *testing.T, name string, actualData []byte) { // `a-z0-9\-\_` is a good idea). func (g *Goldie) AssertJson(t *testing.T, name string, actualJsonData interface{}) { t.Helper() - buf := &bytes.Buffer{} - enc := json.NewEncoder(buf) - enc.SetIndent("", " ") - enc.SetEscapeHTML(false) - err := enc.Encode(actualJsonData) + js, err := json.MarshalIndent(actualJsonData, "", " ") if err != nil { t.Error(err) t.FailNow() } - g.Assert(t, name, normalizeLF(buf.Bytes())) + g.Assert(t, name, normalizeLF(js)) } // AssertXml compares the actual xml data received with expected data in the