diff --git a/Tests/LibC/CMakeLists.txt b/Tests/LibC/CMakeLists.txt index 9976d2ebab..312188b896 100644 --- a/Tests/LibC/CMakeLists.txt +++ b/Tests/LibC/CMakeLists.txt @@ -1,4 +1,5 @@ set(TEST_SOURCES + TestAbort.cpp TestIo.cpp TestLibCExec.cpp TestLibCDirEnt.cpp diff --git a/Tests/LibC/TestAbort.cpp b/Tests/LibC/TestAbort.cpp new file mode 100644 index 0000000000..2572fc3c67 --- /dev/null +++ b/Tests/LibC/TestAbort.cpp @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2021, the SerenityOS developers. + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include + +#include // FIXME: Remove when `_abort` is moved to +#include + +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; + }); +}