forked from TrueCloudLab/frostfs-api-go
[#302] pkg/object: Convert nil SplitInfo
to nil message
Document that `SplitInfo.ToV2` method return `nil` when called on `nil`. Document that `NewSplitInfoFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d443904e43
commit
5cbdef1e46
2 changed files with 23 additions and 0 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/object"
|
||||
objv2 "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -51,3 +52,19 @@ func generateID() *object.ID {
|
|||
|
||||
return id
|
||||
}
|
||||
|
||||
func TestNewSplitInfoFromV2(t *testing.T) {
|
||||
t.Run("from nil", func(t *testing.T) {
|
||||
var x *objv2.SplitInfo
|
||||
|
||||
require.Nil(t, object.NewSplitInfoFromV2(x))
|
||||
})
|
||||
}
|
||||
|
||||
func TestSplitInfo_ToV2(t *testing.T) {
|
||||
t.Run("nil", func(t *testing.T) {
|
||||
var x *object.SplitInfo
|
||||
|
||||
require.Nil(t, x.ToV2())
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue