Conversation
|
I don't understand this fix. Can you explain it? If the reason a call doesn't match an expectation is an |
|
@balshetzer Sorry,I couldn't think of another better reason to describe and I thought it was the simplest way to fix it |
|
Some additional info This will produce an error message with no additional information following
Line 85 in 1bf84fa
Line 90 in 1bf84fa |
|
|
||
| if expectedNum == 0 && exhaustedNum == 0 { | ||
| fmt.Fprintf(&callsErrors, "there are no expected calls of the method %q for that receiver", method) | ||
| } else if exhaustedNum > 0 && callsErrors.Len() == 0 { |
There was a problem hiding this comment.
Is exhaustedNum required? At this point of the function we know we are in error behavior. Are there any other cases where callsErrors.Len() == 0?
|
|
||
| if expectedNum == 0 && exhaustedNum == 0 { | ||
| fmt.Fprintf(&callsErrors, "there are no expected calls of the method %q for that receiver", method) | ||
| } else if exhaustedNum > 0 && callsErrors.Len() == 0 { |
There was a problem hiding this comment.
I think a comment here explaining what error scenario we are handling (i.e. an ordering error) and the rational behind the check for this scenario would be really good.
| expectedNum := len(expected) | ||
| exhaustedNum := len(exhausted) | ||
|
|
||
| if expectedNum == 0 && exhaustedNum == 0 { |
There was a problem hiding this comment.
Is this check safe to change? I don't think it is possible for len to ever be less than zero so it seems fine to me.
|
@mjaow are you interested in continuing to work on this PR? If not I'm happy to take it over. |
Fix #291
check exhaustedNum and callsErrors.len() , if it's true, fill with error msg