[#288] pkg/eacl: Convert nil eACL target to nil API v2 message

Make `Target.ToV2` method to return `nil` when called on `nil`. Write
corresponding unit test.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-27 14:31:30 +03:00 committed by Leonard Lyubich
parent 8f27d857fa
commit 5844096017
2 changed files with 14 additions and 0 deletions

View file

@ -61,3 +61,11 @@ func TestTargetEncoding(t *testing.T) {
require.Equal(t, tar, tar2)
})
}
func TestTarget_ToV2(t *testing.T) {
t.Run("nil", func(t *testing.T) {
var x *Target
require.Nil(t, x.ToV2())
})
}