Reset a json.Unmarshal destination right before the call

… similar to how we do it in other places.
This commit is contained in:
Miloslav Trmač 2016-05-10 16:55:11 +02:00
parent 2ddaa122ab
commit 345d0c3e2b

View File

@ -62,6 +62,7 @@ func tryUnmarshalModifiedSignature(t *testing.T, sig *privateSignature, validJSO
testJSON, err := json.Marshal(tmp)
require.NoError(t, err)
*sig = privateSignature{}
return json.Unmarshal(testJSON, sig)
}
@ -140,7 +141,6 @@ func TestUnmarshalJSON(t *testing.T) {
func(v mSI) { delete(x(v, "optional"), "creator") },
}
for _, fn := range allowedModificationFns {
s = privateSignature{}
err = tryUnmarshalModifiedSignature(t, &s, validJSON, fn)
require.NoError(t, err)
assert.Equal(t, validSig, s)