testify icon indicating copy to clipboard operation
testify copied to clipboard

Fix for mockCall.Unset() panic (issue #1236)

Open DubbaThony opened this issue 3 years ago • 0 comments

Summary

This PR aims to fix #1236. While it's not the pretties fix, it avoids panic

Changes

Within Unset function instead of iterating over an slice and removing items from it at same time, a temporary slice is created, during iteration orginal logic is used to decide if the item should be removed, and if not, item is added to temporary slice. After iteration temporary slice overrides orginal slice, preventing panic.

Motivation

As library user, I want this function to work.

Related issues

Closes #1236

DubbaThony avatar Jul 27 '22 14:07 DubbaThony