[OptTable] Fix typo VALUE => VALUES (NFCI) (#121523)
[llvm-project.git] / libc / test / src / assert / assert_test.cpp
blobd5d25506053405c3641ae9b03d233eeed7e30c19
1 //===-- Unittests for assert ----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #undef NDEBUG
10 #include "src/assert/assert.h"
11 #include "test/UnitTest/Test.h"
13 extern "C" int close(int);
15 TEST(LlvmLibcAssert, Enabled) {
16 // -1 matches against any signal, which is necessary for now until
17 // LIBC_NAMESPACE::abort() unblocks SIGABRT. Close standard error for the
18 // child process so we don't print the assertion failure message.
19 EXPECT_DEATH(
20 [] {
21 close(2);
22 assert(0);
24 WITH_SIGNAL(-1));
27 #define NDEBUG
28 #include "src/assert/assert.h"
30 TEST(LlvmLibcAssert, Disabled) {
31 EXPECT_EXITS([] { assert(0); }, 0);