[#356] refs: Test text marshaling of nil SubnetID

Add `(*refs.SubnetID)(nil).MarshalText()` unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-11-22 13:22:14 +03:00 committed by LeL
parent dc292864aa
commit 5d99e697aa

View file

@ -35,6 +35,18 @@ func TestSubnetID_MarshalText(t *testing.T) {
require.NoError(t, err)
require.EqualValues(t, val, res)
t.Run("nil", func(t *testing.T) {
var id *refs.SubnetID
txt, err := id.MarshalText()
require.NoError(t, err)
res, err := strconv.ParseUint(string(txt), 10, 32)
require.NoError(t, err)
require.Zero(t, res)
})
}
func TestSubnetID_UnmarshalText(t *testing.T) {