mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:27:35 +00:00
LibTest: Add EXPECT_NO_CRASH
This commit is contained in:
parent
4c6e826c05
commit
7a44c11378
5 changed files with 31 additions and 0 deletions
|
@ -64,6 +64,8 @@ bool Crash::do_report(Report report)
|
|||
bool pass = false;
|
||||
if (m_crash_signal == ANY_SIGNAL) {
|
||||
pass = report.has<int>();
|
||||
} else if (m_crash_signal == 0) {
|
||||
pass = report.has<Failure>() && report.get<Failure>() == Failure::DidNotCrash;
|
||||
} else if (m_crash_signal > 0) {
|
||||
pass = report.has<int>() && report.get<int>() == m_crash_signal;
|
||||
} else {
|
||||
|
|
|
@ -134,3 +134,10 @@ void current_test_case_did_fail();
|
|||
if (!crash.run()) \
|
||||
::Test::current_test_case_did_fail(); \
|
||||
} while (false)
|
||||
|
||||
#define EXPECT_NO_CRASH(test_message, test_func) \
|
||||
do { \
|
||||
Test::Crash crash(test_message, test_func, 0); \
|
||||
if (!crash.run()) \
|
||||
::Test::current_test_case_did_fail(); \
|
||||
} while (false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue