Skip to content

Commit ec849d9

Browse files
committed
[tests] Fix BOOST_CHECK_THROW macro
BOOST_CHECK_THROW doesn't correctly fail the test if no exception is throw. Fix that (and add an assert message). Bug and fix found by MarcoFalke.
1 parent 31bc9f5 commit ec849d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

test/object.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
#define BOOST_CHECK_THROW(stmt, excMatch) { \
2020
try { \
2121
(stmt); \
22+
assert(0 && "No exception caught"); \
2223
} catch (excMatch & e) { \
2324
} catch (...) { \
24-
assert(0); \
25+
assert(0 && "Wrong exception caught"); \
2526
} \
2627
}
2728
#define BOOST_CHECK_NO_THROW(stmt) { \

0 commit comments

Comments
 (0)