Skip to content

Commit

Permalink
[tests] Fix BOOST_CHECK_THROW macro
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnewbery committed Dec 12, 2017
1 parent 31bc9f5 commit ec849d9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
#define BOOST_CHECK_THROW(stmt, excMatch) { \
try { \
(stmt); \
assert(0 && "No exception caught"); \
} catch (excMatch & e) { \
} catch (...) { \
assert(0); \
assert(0 && "Wrong exception caught"); \
} \
}
#define BOOST_CHECK_NO_THROW(stmt) { \
Expand Down

0 comments on commit ec849d9

Please sign in to comment.