diff --git a/pkg/object/splitinfo.go b/pkg/object/splitinfo.go index 600b87b5..cbe71620 100644 --- a/pkg/object/splitinfo.go +++ b/pkg/object/splitinfo.go @@ -6,6 +6,9 @@ import ( type SplitInfo object.SplitInfo +// NewSplitInfoFromV2 wraps v2 SplitInfo message to SplitInfo. +// +// Nil object.SplitInfo converts to nil. func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo { return (*SplitInfo)(v2) } @@ -14,6 +17,9 @@ func NewSplitInfo() *SplitInfo { return NewSplitInfoFromV2(new(object.SplitInfo)) } +// ToV2 converts SplitInfo to v2 SplitInfo message. +// +// Nil SplitInfo converts to nil. func (s *SplitInfo) ToV2() *object.SplitInfo { return (*object.SplitInfo)(s) } diff --git a/pkg/object/splitinfo_test.go b/pkg/object/splitinfo_test.go index 8f07313c..62387101 100644 --- a/pkg/object/splitinfo_test.go +++ b/pkg/object/splitinfo_test.go @@ -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()) + }) +}