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

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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/KirillovDenis/master
Leonard Lyubich 2021-11-22 13:22:14 +03:00 committed by LeL
parent dc292864aa
commit 5d99e697aa
1 changed files with 12 additions and 0 deletions

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) {