Tests: Add test for abort
This commit is contained in:
parent
18dab0384d
commit
181f759dc9
Notes:
sideshowbarker
2024-07-17 22:35:17 +09:00
Author: https://github.com/mhermier Commit: https://github.com/SerenityOS/serenity/commit/181f759dc93 Pull-request: https://github.com/SerenityOS/serenity/pull/11291
2 changed files with 27 additions and 0 deletions
Tests/LibC
|
@ -1,4 +1,5 @@
|
|||
set(TEST_SOURCES
|
||||
TestAbort.cpp
|
||||
TestIo.cpp
|
||||
TestLibCExec.cpp
|
||||
TestLibCDirEnt.cpp
|
||||
|
|
26
Tests/LibC/TestAbort.cpp
Normal file
26
Tests/LibC/TestAbort.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibTest/TestCase.h>
|
||||
|
||||
#include <assert.h> // FIXME: Remove when `_abort` is moved to <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST_CASE(_abort)
|
||||
{
|
||||
EXPECT_CRASH("This should _abort", [] {
|
||||
_abort();
|
||||
return Test::Crash::Failure::DidNotCrash;
|
||||
});
|
||||
}
|
||||
|
||||
TEST_CASE(abort)
|
||||
{
|
||||
EXPECT_CRASH("This should abort", [] {
|
||||
abort();
|
||||
return Test::Crash::Failure::DidNotCrash;
|
||||
});
|
||||
}
|
Loading…
Add table
Reference in a new issue