Don't trap exceptions in unit tests when in debug mode
parent
879417cb0d
commit
9732094f41
|
@ -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
|
* 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)\
|
#define TEST_UNSAFE(testName, testGroup)\
|
||||||
class testGroup##testName##Test : public Test \
|
class testGroup##testName##Test : public Test \
|
||||||
|
@ -80,6 +69,23 @@ protected:
|
||||||
testGroup##testName##Instance; \
|
testGroup##testName##Instance; \
|
||||||
void testGroup##testName##Test::run (TestResult& result_)
|
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:
|
* Convention for tests:
|
||||||
* - "EXPECT" is a test that will not end execution of the series of tests
|
* - "EXPECT" is a test that will not end execution of the series of tests
|
||||||
|
|
Loading…
Reference in New Issue