Tests: Add test for abort

This commit is contained in:
Michel Hermier 2021-12-17 17:58:55 +01:00 committed by Brian Gianforcaro
parent 18dab0384d
commit 181f759dc9
Notes: sideshowbarker 2024-07-17 22:35:17 +09:00
2 changed files with 27 additions and 0 deletions

View file

@ -1,4 +1,5 @@
set(TEST_SOURCES
TestAbort.cpp
TestIo.cpp
TestLibCExec.cpp
TestLibCDirEnt.cpp

26
Tests/LibC/TestAbort.cpp Normal file
View 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;
});
}