Changes
2 changed files (+14/-6)
-
-
@@ -284,6 +284,7 @@ func RecipientsDeduplication(recArgs ...*ObjectsArr) error {if recList == nil { continue } toRemove := make([]int, 0) for i, rec := range *recList { save := true
-
@@ -301,11 +302,7 @@ func RecipientsDeduplication(recArgs ...*ObjectsArr) error {sort.Sort(sort.Reverse(sort.IntSlice(toRemove))) for _, idx := range toRemove { if idx == len(*recList) { *recList = (*recList)[:idx] } else { *recList = append((*recList)[:idx], (*recList)[idx+1:]...) } *recList = append((*recList)[:idx], (*recList)[idx+1:]...) } } return nil
-
-
-
@@ -178,7 +178,18 @@ func TestRecipientsDeduplication(t *testing.T) {RecipientsDeduplication(&first) if len(first) != 4 { t.Errorf("Objects array should have exactly 8(eight) elements, not %d", len(first)) t.Errorf("Objects array should have exactly 4(four) elements, not %d", len(first)) } second := make(ObjectsArr, 0) second.Append(bar) second.Append(foo) RecipientsDeduplication(&first, &second) if len(first) != 4 { t.Errorf("First Objects array should have exactly 8(eight) elements, not %d", len(first)) } if len(second) != 0 { t.Errorf("Second Objects array should have exactly 0(zero) elements, not %d", len(second)) } }
-