mockitopp icon indicating copy to clipboard operation
mockitopp copied to clipboard

mock.verify() should throw instead of returning a bool

Open GoogleCodeExporter opened this issue 9 years ago • 1 comments

What is the expected output? What do you see instead?

mock.verify() should throw a std::exception-derived exception, with what() 
being populated with information about exactly what missing. that way, it is 
likely they can see the failure message output by the test framework's 
high-level exception handler and immediately know what's going on.


right now, mock.verify() returns a bool. what an assertion against that bool 
fails, most test frameworks output something like "expected true, but got 
false". This leads the developer to have to add printfs or fire up the 
debugger, which greatly reduced productivity/flow.





Original issue reported on code.google.com by [email protected] on 21 Sep 2011 at 9:55

GoogleCodeExporter avatar Mar 19 '15 03:03 GoogleCodeExporter

I will model our verification exceptions types similar to those found in 
Mockito.
see: 
http://code.google.com/p/mockito/source/browse/#hg%2Fsrc%2Forg%2Fmockito%2Fexcep
tions%2Fverification%253Fstate%253Dclosed

Original comment by [email protected] on 15 Oct 2011 at 7:33

GoogleCodeExporter avatar Mar 19 '15 03:03 GoogleCodeExporter