simulacrum icon indicating copy to clipboard operation
simulacrum copied to clipboard

Param mismatch is misreported as called-too-many-times

Open jasongrlicky opened this issue 7 years ago • 0 comments

I haven't fully pinned it down yet, but there's some type of unexpected behavior, where:

  1. You have an expectation for a method to be called once with a parameter constraint
  2. That method is called with the wrong parameters
  3. There is then() after that method
  4. After the then(), there is another expectation for that same method to be called once

If all of that happens, then the problem will be reported as the method being called one too many times instead of a param mismatch.


Originally observed in code like the following:

let mut g = Mock::new();
g.expect_method_1().called_once().with(any());
g.expect_method_2().called_once().with(none());
g.then();
g..expect_method1().called_once().with(any());
g.expect_method_2().called_once().with(any());

jasongrlicky avatar Mar 30 '18 07:03 jasongrlicky