From 96b20487a9babf0a6b11f5377bd47cdc805801d7 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Thu, 6 Dec 2012 20:08:52 +0000 Subject: [PATCH] Reverting - Don't trap exceptions in unit tests when in debug mode (reverse-merged from commit 51a7c8e209bafd889982f21e0e40a034afdb36d6) --- CppUnitLite/Test.h | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/CppUnitLite/Test.h b/CppUnitLite/Test.h index 80d3cf2c4..52b79f65c 100644 --- a/CppUnitLite/Test.h +++ b/CppUnitLite/Test.h @@ -57,9 +57,20 @@ 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 \ @@ -69,23 +80,6 @@ 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