[#302] pkg/object: Convert nil SplitID to nil message

Document that `SplitID.ToV2` method return `nil`
when called on `nil`. Document that `NewSplitIDFromV2`
function return `nil` when called on `nil`. Write
corresponding unit tests.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-06-09 16:18:56 +03:00 committed by Alex Vanin
parent 2fb67d99d3
commit bbd651767e
2 changed files with 23 additions and 0 deletions

View file

@ -46,3 +46,18 @@ func TestSplitID(t *testing.T) {
})
}
func TestSplitID_ToV2(t *testing.T) {
t.Run("nil", func(t *testing.T) {
var x *object.SplitID
require.Nil(t, x.ToV2())
})
}
func TestNewIDFromV2(t *testing.T) {
t.Run("from nil", func(t *testing.T) {
var x []byte
require.Nil(t, object.NewSplitIDFromV2(x))
})
}