CxxTest/cxxtest

tearDown() not called when exception is thrown and abortTestOnFail is set

kindkaktus opened this issue · 0 comments

I tend to use tearDown() to cleanup resources allocated in setUp().
I also set abortTestOnFail to true to immediately stop the test on the first error.

I came across with an unpleasant issue that when (C++) exception is thrown from within a test case, the test immediately stops but tearDown() is not called, causing resource leaks etc.

One workaround for this is to surround all test cases with
try
{
..
}
catch(...)
{
TS_FAIL("exception thrown");
}

but this introduces a lot of ugly boilerplate code.

I can also volunteer to look for a fix for this (just let me know).