summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorMichel Hermier <michel.hermier@gmail.com>2021-12-17 17:58:55 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-19 14:22:06 -0800
commit181f759dc93fcfa11f8d5692624bf1f597d3f404 (patch)
treebdeb8db0f3022eb0d826a412af682a9c2acdd31c /Tests
parent18dab0384d592938c596cdafeb112ae42ef603d0 (diff)
downloadserenity-181f759dc93fcfa11f8d5692624bf1f597d3f404.zip
Tests: Add test for `abort`
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibC/CMakeLists.txt1
-rw-r--r--Tests/LibC/TestAbort.cpp26
2 files changed, 27 insertions, 0 deletions
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 <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;
+ });
+}