diff --git a/CppUnitLite/Test.h b/CppUnitLite/Test.h index 52b79f65c..80d3cf2c4 100644 --- a/CppUnitLite/Test.h +++ b/CppUnitLite/Test.h @@ -57,20 +57,9 @@ protected: }; -/** - * Normal test will wrap execution in a try/catch block to catch exceptions more effectively - */ -#define TEST(testName, testGroup)\ - class testGroup##testName##Test : public Test \ - { public: testGroup##testName##Test () : Test (#testName "Test", __FILE__, __LINE__, true) {} \ - virtual ~testGroup##testName##Test () {};\ - void run (TestResult& result_);} \ - testGroup##testName##Instance; \ - void testGroup##testName##Test::run (TestResult& result_) - /** * For debugging only: use TEST_UNSAFE to allow debuggers to have access to exceptions, as this - * will not wrap execution with a try/catch block + * will not wrap execution with a try/catch block. */ #define TEST_UNSAFE(testName, testGroup)\ class testGroup##testName##Test : public Test \ @@ -80,6 +69,23 @@ protected: testGroup##testName##Instance; \ void testGroup##testName##Test::run (TestResult& result_) +/** + * Normal test will wrap execution in a try/catch block to catch exceptions + * more effectively (except in debug mode where they will be uncaught to pass on + * to the debugger.) + */ +#ifdef NDEBUG +#define TEST(testName, testGroup)\ + class testGroup##testName##Test : public Test \ + { public: testGroup##testName##Test () : Test (#testName "Test", __FILE__, __LINE__, true) {} \ + virtual ~testGroup##testName##Test () {};\ + void run (TestResult& result_);} \ + testGroup##testName##Instance; \ + void testGroup##testName##Test::run (TestResult& result_) +#else +#define TEST TEST_UNSAFE +#endif + /* * Convention for tests: * - "EXPECT" is a test that will not end execution of the series of tests