lest icon indicating copy to clipboard operation
lest copied to clipboard

Let EXPECT print the error message before throwing an exception

Open martinmoene opened this issue 6 years ago • 0 comments

Detlef Vollmann brings up the following:

I'm using lest for test cases for the exercises of a C++ course. My problem is that sometimes I EXPECT some invariant of an object, and if that's failing, it's not safe to call the destructor.

However, EXPECT throws an exception before it prints its message, so effectively I get a crash by the destructor of the local test object and never see the message from the failed test, which is not very useful.

Preferably I'd like to avoid the crash completely (by calling exit() or terminate() myself), but the minimum would be to at least see the message before the crash.

martinmoene avatar Oct 21 '19 18:10 martinmoene