Skip to content

Commit a016bb6

Browse files
committed
fixture.h: properly handle stray exceptions in TEST_CASE
1 parent ead1b9e commit a016bb6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/fixture.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class TestFixture : public ErrorLogger {
272272
};
273273

274274
// TODO: most asserts do not actually assert i.e. do not return
275-
#define TEST_CASE( NAME ) do { if (prepareTest(#NAME)) { setVerbose(false); NAME(); teardownTest(); } } while (false)
275+
#define TEST_CASE( NAME ) do { if (prepareTest(#NAME)) { setVerbose(false); try { NAME(); } catch(...) { assertNoThrowFail(__FILE__, __LINE__); } teardownTest(); } } while (false)
276276
#define ASSERT( CONDITION ) if (!assert_(__FILE__, __LINE__, (CONDITION))) return
277277
#define ASSERT_LOC( CONDITION, FILE_, LINE_ ) assert_(FILE_, LINE_, (CONDITION))
278278
#define CHECK_EQUALS( EXPECTED, ACTUAL ) assertEquals(__FILE__, __LINE__, (EXPECTED), (ACTUAL))

0 commit comments

Comments
 (0)