diff --git a/tests/testprec.h b/tests/testprec.h index 3514e79f9c..530d5fca35 100644 --- a/tests/testprec.h +++ b/tests/testprec.h @@ -78,14 +78,19 @@ public: #if wxDEBUG_LEVEL // some old cppunit versions don't define CPPUNIT_ASSERT_THROW so roll our // own - #define WX_ASSERT_FAILS_WITH_ASSERT(cond) \ - { \ + #define WX_ASSERT_FAILS_WITH_ASSERT_MESSAGE(msg, code) \ + wxSTATEMENT_MACRO_BEGIN \ bool throwsAssert = false; \ - try { cond ; } \ + try { code ; } \ catch ( const TestAssertFailure& ) { throwsAssert = true; } \ if ( !throwsAssert ) \ - CPPUNIT_FAIL("expected assertion not generated"); \ - } + CPPUNIT_FAIL(msg); \ + wxSTATEMENT_MACRO_END + + #define WX_ASSERT_FAILS_WITH_ASSERT(code) \ + WX_ASSERT_FAILS_WITH_ASSERT_MESSAGE( \ + "expected assertion not generated", code) + #else // there are no assertions in this build so we can't do anything (we used // to check that the condition failed but this didn't work well as in