From 6f08ca8a8a5c105b3ced32be957f99719b8cf415 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 11 Apr 2014 09:04:53 -0500 Subject: [PATCH] Correct unmarshal for GetAddressBalanceCmd. The unmarshaller for the GetAddressBalanceCmd was calling the wrong parse function. It wasn't caught by the tests because the error on UnmarshalJSON was being ignored, so this commit also updates the tests to check the error. --- cmds.go | 2 +- cmds_test.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmds.go b/cmds.go index 7204231da..8303d1ecd 100644 --- a/cmds.go +++ b/cmds.go @@ -1636,7 +1636,7 @@ func (cmd *GetAddressBalanceCmd) UnmarshalJSON(b []byte) error { return err } - newCmd, err := parseListAllTransactionsCmd(&r) + newCmd, err := parseGetAddressBalanceCmd(&r) if err != nil { return err } diff --git a/cmds_test.go b/cmds_test.go index 3325d4c16..5e0d3f0a4 100644 --- a/cmds_test.go +++ b/cmds_test.go @@ -346,7 +346,10 @@ func TestCmds(t *testing.T) { // Read marshaled command back into c. Should still // match result. - c.UnmarshalJSON(mc) + if err := c.UnmarshalJSON(mc); err != nil { + t.Errorf("%s: error while unmarshalling: %v", test.name, + err) + } if !reflect.DeepEqual(test.result, c) { t.Errorf("%s: unmarshal not as expected. "+ "got %v wanted %v", test.name, spew.Sdump(c),