mirror of
https://github.com/containers/skopeo.git
synced 2025-07-31 22:45:20 +00:00
Reset a json.Unmarshal destination right before the call
… similar to how we do it in other places.
This commit is contained in:
parent
2ddaa122ab
commit
345d0c3e2b
@ -62,6 +62,7 @@ func tryUnmarshalModifiedSignature(t *testing.T, sig *privateSignature, validJSO
|
|||||||
testJSON, err := json.Marshal(tmp)
|
testJSON, err := json.Marshal(tmp)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
*sig = privateSignature{}
|
||||||
return json.Unmarshal(testJSON, sig)
|
return json.Unmarshal(testJSON, sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +141,6 @@ func TestUnmarshalJSON(t *testing.T) {
|
|||||||
func(v mSI) { delete(x(v, "optional"), "creator") },
|
func(v mSI) { delete(x(v, "optional"), "creator") },
|
||||||
}
|
}
|
||||||
for _, fn := range allowedModificationFns {
|
for _, fn := range allowedModificationFns {
|
||||||
s = privateSignature{}
|
|
||||||
err = tryUnmarshalModifiedSignature(t, &s, validJSON, fn)
|
err = tryUnmarshalModifiedSignature(t, &s, validJSON, fn)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, validSig, s)
|
assert.Equal(t, validSig, s)
|
||||||
|
Loading…
Reference in New Issue
Block a user