1 //===-- Unittests for assert ----------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
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.
28 #include "src/assert/assert.h"
30 TEST(LlvmLibcAssert
, Disabled
) {
31 EXPECT_EXITS([] { assert(0); }, 0);