forked from TrueCloudLab/frostfs-api-go
[#302] pkg/object: Convert nil Range
to nil message
Document that `Range.ToV2` method return `nil` when called on `nil`. Document that `NewRangeFromV2` 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
6c12b4dfb6
commit
4e40f195bc
2 changed files with 21 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
package object
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -23,3 +24,19 @@ func TestRange_SetLength(t *testing.T) {
|
|||
|
||||
require.Equal(t, ln, r.GetLength())
|
||||
}
|
||||
|
||||
func TestNewRangeFromV2(t *testing.T) {
|
||||
t.Run("from nil", func(t *testing.T) {
|
||||
var x *object.Range
|
||||
|
||||
require.Nil(t, NewRangeFromV2(x))
|
||||
})
|
||||
}
|
||||
|
||||
func TestRange_ToV2(t *testing.T) {
|
||||
t.Run("nil", func(t *testing.T) {
|
||||
var x *Range
|
||||
|
||||
require.Nil(t, x.ToV2())
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue