diff --git a/common/types_test.go b/common/types_test.go index d7d310576d..1ec2bfc26c 100644 --- a/common/types_test.go +++ b/common/types_test.go @@ -158,8 +158,12 @@ func BenchmarkAddressHex(b *testing.B) { func TestRemoveItemInArray(t *testing.T) { array := []Address{HexToAddress("0x0000003"), HexToAddress("0x0000001"), HexToAddress("0x0000002"), HexToAddress("0x0000003")} remove := []Address{HexToAddress("0x0000002"), HexToAddress("0x0000004"), HexToAddress("0x0000003")} - array = RemoveItemFromArray(array, remove) - if len(array) != 1 { + newArray := RemoveItemFromArray(array, remove) + + if array[0] != HexToAddress("0x0000003") || array[2] != HexToAddress("0x0000002") { + t.Error("should keep the original item from array address") + } + if len(newArray) != 1 { t.Error("fail remove item from array address") } }