From 6bb509f48f20a20e16b447ddcecbf3d55a4aa0a3 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Mon, 12 Dec 2016 22:22:41 -0500 Subject: tweak marshalling --- marshall_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'marshall_test.go') diff --git a/marshall_test.go b/marshall_test.go index b5e9fae..ad4d6fd 100644 --- a/marshall_test.go +++ b/marshall_test.go @@ -15,13 +15,15 @@ func TestMarshallXML(t *testing.T) { Time: 1479682785, Album: Correctable{Name: "Mellow Gold"}}, } - fmt.Printf("%v\n", s) scrobbles := Scrobbles{Scrobbles: s, Attrs: Attrs{1, 0}} - output, err := xml.MarshalIndent(scrobbles, " ", " ") + response := LFMResponse{Status: "ok", + Response: scrobbles} + output, err := xml.MarshalIndent(response, " ", " ") if err != nil { fmt.Printf("error: %v\n", err) } + fmt.Printf(xml.Header) os.Stdout.Write(output) } @@ -34,8 +36,9 @@ func TestMarshallJSON(t *testing.T) { } scrobbles := Scrobbles{Scrobbles: s, Attrs: Attrs{1, 0}} - jsonscrobble := map[string]Scrobbles{"scrobbles": scrobbles} - output, err := json.MarshalIndent(jsonscrobble, " ", " ") + response := LFMResponse{Status: "ok", + Response: scrobbles} + output, err := json.MarshalIndent(response, " ", " ") if err != nil { fmt.Printf("error: %v\n", err) } -- cgit v1.2.3-70-g09d2