You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have chosen not to include the output of composer info |sort since it's not relevant to this issue.
Summary
Failure description for count assertion is wrong for generators.
Current behavior
The function getCountOfGenerator correctly counts the number of elements in a generator. However, generators can only be iterated over once. When the match fails, failureDescription() is called:
I have chosen not to include the output of
composer info |sort
since it's not relevant to this issue.Summary
Failure description for count assertion is wrong for generators.
Current behavior
The function
getCountOfGenerator
correctly counts the number of elements in a generator. However, generators can only be iterated over once. When the match fails,failureDescription()
is called:Which does another iteration, but since the pointer is already at the end this always yields 0.
How to reproduce
Output
Expected behavior
Solution
Looking at the implementation of the
Count
assertion, it feels a little overcomplicated to me.It has all kinds of special cases that are not needed (anymore?):
I'll work on a PR to fix this issue and simplify the code a bit.
The text was updated successfully, but these errors were encountered: