testify icon indicating copy to clipboard operation
testify copied to clipboard

Speed up mock.findExpectedCall by skipping diff if not necessary

Open mrahs opened this issue 5 years ago • 2 comments

Summary

Speed up mock.findExpectedCall by skipping argument diffing if not necessary

Changes

Modified the function to skip over used up expected calls. Everything else remains the same from the user's perspective, including the associated special printed message for such cases.

Motivation

I have test suites with many one-time expected calls. I have noticed that the suite keeps accumulating such expired calls and evaluates every one of them before reaching the few usable ones. Ideally, such calls should be discarded to save space and cycles, but that's an optimization for another day.

Related issues

Closes #983

mrahs avatar Jul 28 '20 05:07 mrahs

@boyan-soubachov I wonder if you can take a look?

mrahs avatar Oct 18 '20 23:10 mrahs

@boyan-soubachov thank you for the review. I have updated the code to preserve visible behavior and a added a test case for expected error when a method has been used up to ensure consistent behavior before and after this change.

mrahs avatar Nov 08 '20 17:11 mrahs