mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-16 00:46:03 +08:00
Defines CHECK_NO_THROW
Defines CHECK_NO_THROW if not already defined.
This commit is contained in:
parent
102e4a8bed
commit
a956df84e0
23
test/ExtraCheckMacros.h
Normal file
23
test/ExtraCheckMacros.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef UNITTEST_EXTRA_CHECKMACROS_H
|
||||
#define UNITTEST_EXTRA_CHECKMACROS_H
|
||||
|
||||
#include <UnitTest++/HelperMacros.h>
|
||||
#include <UnitTest++/ExceptionMacros.h>
|
||||
#include <UnitTest++/Checks.h>
|
||||
#include <UnitTest++/AssertException.h>
|
||||
#include <UnitTest++/MemoryOutStream.h>
|
||||
#include <UnitTest++/TestDetails.h>
|
||||
#include <UnitTest++/CurrentTest.h>
|
||||
#include <UnitTest++/ReportAssertImpl.h>
|
||||
|
||||
#ifndef CHECK_NO_THROW
|
||||
#define CHECK_NO_THROW(expression) \
|
||||
UNITTEST_MULTILINE_MACRO_BEGIN \
|
||||
bool caught_ = false; \
|
||||
try { expression; } \
|
||||
catch (...) { caught_ = true; } \
|
||||
if (caught_) \
|
||||
UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), "Unexpected exception thrown"); \
|
||||
UNITTEST_MULTILINE_MACRO_END
|
||||
#endif
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user