[#168] refs: Implement binary/JSON encoders/decoders on Version

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 16:19:16 +03:00 committed by Alex Vanin
parent 9ec57ee9f8
commit 1519a02d63
6 changed files with 103 additions and 4 deletions

View file

@ -57,3 +57,15 @@ func TestOwnerIDJSON(t *testing.T) {
require.Equal(t, o, o2)
}
func TestVersionSON(t *testing.T) {
v := generateVersion(1, 2)
data, err := v.MarshalJSON()
require.NoError(t, err)
v2 := new(refs.Version)
require.NoError(t, v2.UnmarshalJSON(data))
require.Equal(t, v, v2)
}