Skip to content

Commit

Permalink
fixture.h: properly handle stray exceptions in TEST_CASE
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Mar 5, 2024
1 parent ead1b9e commit 18ab7d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class TestFixture : public ErrorLogger {
};

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

0 comments on commit 18ab7d9

Please sign in to comment.