[Box Backup-commit] COMMIT r3255 - box/trunk/lib/common
subversion at boxbackup.org
subversion at boxbackup.org
Tue Feb 11 10:29:20 GMT 2014
Author: chris
Date: 2014-02-11 10:29:20 +0000 (Tue, 11 Feb 2014)
New Revision: 3255
Modified:
box/trunk/lib/common/Test.h
Log:
Add a TEST_THAT_THROWONFAIL macro that throws an AssertFailed exception.
Allows aborting tests from any depth of function calls.
Modified: box/trunk/lib/common/Test.h
===================================================================
--- box/trunk/lib/common/Test.h 2014-02-11 10:29:13 UTC (rev 3254)
+++ box/trunk/lib/common/Test.h 2014-02-11 10:29:20 UTC (rev 3255)
@@ -51,6 +51,14 @@
#define TEST_THAT(condition) {if(!(condition)) TEST_FAIL_WITH_MESSAGE("Condition [" #condition "] failed")}
#define TEST_THAT_ABORTONFAIL(condition) {if(!(condition)) TEST_ABORT_WITH_MESSAGE("Condition [" #condition "] failed")}
+#define TEST_THAT_THROWONFAIL(condition) \
+ { \
+ if(!(condition)) \
+ { \
+ THROW_EXCEPTION_MESSAGE(CommonException, \
+ AssertFailed, "Condition [" #condition "] failed"); \
+ } \
+ }
// NOTE: The 0- bit is to allow this to work with stuff which has negative constants for flags (eg ConnectionException)
#define TEST_CHECK_THROWS(statement, excepttype, subtype) \
More information about the Boxbackup-commit
mailing list