aboutsummaryrefslogtreecommitdiffstats
path: root/TestHelper.h
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-03-09 20:33:10 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-03-09 20:33:10 +0800
commitac96c5bf599d94b35dd80e01d9f66d12e54f4ec2 (patch)
tree46e19747123a088b263944ac3061556c9dacedb6 /TestHelper.h
parentdab392876af4ecb73f7f322c825c9a0d411b59ca (diff)
parentd586a88f3cab21db88f31dd574daac4bb9a28b7d (diff)
downloaddexon-solidity-ac96c5bf599d94b35dd80e01d9f66d12e54f4ec2.tar
dexon-solidity-ac96c5bf599d94b35dd80e01d9f66d12e54f4ec2.tar.gz
dexon-solidity-ac96c5bf599d94b35dd80e01d9f66d12e54f4ec2.tar.bz2
dexon-solidity-ac96c5bf599d94b35dd80e01d9f66d12e54f4ec2.tar.lz
dexon-solidity-ac96c5bf599d94b35dd80e01d9f66d12e54f4ec2.tar.xz
dexon-solidity-ac96c5bf599d94b35dd80e01d9f66d12e54f4ec2.tar.zst
dexon-solidity-ac96c5bf599d94b35dd80e01d9f66d12e54f4ec2.zip
Merge branch 'develop' into new_jsonrpc
Diffstat (limited to 'TestHelper.h')
-rw-r--r--TestHelper.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/TestHelper.h b/TestHelper.h
index 91ec977d..0f23f945 100644
--- a/TestHelper.h
+++ b/TestHelper.h
@@ -46,39 +46,55 @@ namespace test
/// Make sure that no Exception is thrown during testing. If one is thrown show its info and fail the test.
/// Our version of BOOST_REQUIRE_NO_THROW()
-/// @param _expression The expression for which to make sure no exceptions are thrown
+/// @param _statenent The statement for which to make sure no exceptions are thrown
/// @param _message A message to act as a prefix to the expression's error information
-#define ETH_TEST_REQUIRE_NO_THROW(_expression, _message) \
+#define ETH_TEST_REQUIRE_NO_THROW(_statement, _message) \
do \
{ \
try \
{ \
- _expression; \
+ BOOST_TEST_PASSPOINT(); \
+ _statement; \
} \
catch (boost::exception const& _e) \
{ \
- auto msg = std::string(_message"\n") + boost::diagnostic_information(_e); \
- BOOST_FAIL(msg); \
+ auto msg = std::string(_message " due to an exception thrown by " \
+ BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \
+ BOOST_CHECK_IMPL(false, msg, REQUIRE, CHECK_MSG); \
} \
- } while (0)
+ catch (...) \
+ { \
+ BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \
+ BOOST_STRINGIZE(_statement), REQUIRE, CHECK_MSG); \
+ } \
+ } \
+ while (0)
/// Check if an Exception is thrown during testing. If one is thrown show its info and continue the test
/// Our version of BOOST_CHECK_NO_THROW()
-/// @param _expression The expression for which to make sure no exceptions are thrown
+/// @param _statement The statement for which to make sure no exceptions are thrown
/// @param _message A message to act as a prefix to the expression's error information
-#define ETH_TEST_CHECK_NO_THROW(_expression, _message) \
+#define ETH_TEST_CHECK_NO_THROW(_statement, _message) \
do \
{ \
try \
{ \
- _expression; \
+ BOOST_TEST_PASSPOINT(); \
+ _statement; \
} \
catch (boost::exception const& _e) \
{ \
- auto msg = std::string(_message"\n") + boost::diagnostic_information(_e); \
- BOOST_MESSAGE(msg); \
+ auto msg = std::string(_message " due to an exception thrown by " \
+ BOOST_STRINGIZE(_statement) "\n") + boost::diagnostic_information(_e); \
+ BOOST_CHECK_IMPL(false, msg, CHECK, CHECK_MSG); \
+ } \
+ catch (...) \
+ { \
+ BOOST_CHECK_IMPL(false, "Unknown exception thrown by " \
+ BOOST_STRINGIZE(_statement), CHECK, CHECK_MSG ); \
} \
- } while (0)
+ } \
+ while (0)
class ImportTest