From 5764dbc249836cb0b80e401692c941fa1afb7a24 Mon Sep 17 00:00:00 2001 From: Liam Lai Date: Thu, 14 Apr 2022 02:17:30 -0600 Subject: [PATCH] update test for RemoveItemFromArray --- common/types_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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") } }