Skip to content

Commit

Permalink
Fixed CxxTest#89 (tearDown() not called when exception is thrown and …
Browse files Browse the repository at this point in the history
…abortTestOnFail is set)

Fixed by restricting the effect of TS_ABORT to TS_XXX macros. TS_ABORT should not be called on an upper level because this causes the following negative effects:
- the entire test stops (world)
- tearDown() are not called neither for test cases nor for test suites which may result in resource leaks
  • Loading branch information
kindkaktus authored and Oliviers-OSS committed Aug 5, 2015
1 parent ff8b1a7 commit 62d12e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cxxtest/TestSuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,14 @@ void doAssertSameFiles(const char* file, int line,
# define _TS_CATCH_ABORT(b) _TS_CATCH_TYPE( (const CxxTest::AbortTest &), b )
# define _TS_CATCH_SKIPPED(b) _TS_CATCH_TYPE( (const CxxTest::SkipTest &), b )
# define _TS_LAST_CATCH(b) _TS_CATCH_TYPE( (...), b )
# define _TSM_LAST_CATCH(f,l,m) _TS_LAST_CATCH( { (CxxTest::tracker()).failedTest(f,l,m); TS_ABORT(); } )
# define _TSM_LAST_CATCH(f,l,m) _TS_LAST_CATCH( { (CxxTest::tracker()).failedTest(f,l,m); } )
# ifdef _CXXTEST_HAVE_STD
# define _TS_CATCH_STD(e,b) _TS_CATCH_TYPE( (const std::exception& e), b )
# else // !_CXXTEST_HAVE_STD
# define _TS_CATCH_STD(e,b)
# endif // _CXXTEST_HAVE_STD
# define ___TSM_CATCH(f,l,m) \
_TS_CATCH_STD(e, { (CxxTest::tracker()).failedTest(f,l,e.what()); TS_ABORT(); }) \
_TS_CATCH_STD(e, { (CxxTest::tracker()).failedTest(f,l,e.what()); }) \
_TSM_LAST_CATCH(f,l,m)
# define __TSM_CATCH(f,l,m) \
_TS_CATCH_ABORT( { throw; } ) \
Expand Down

0 comments on commit 62d12e8

Please sign in to comment.