1//===----------------------------------------------------------------------===//
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//===----------------------------------------------------------------------===//
8
9#ifndef TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_ASSERT_TEST_HELPERS_H
10#define TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_ASSERT_TEST_HELPERS_H
11
12#if !__has_include(<unistd.h>) || !__has_include(<sys/wait.h>)
13# error "Requires UNIX headers"
14#endif
15
16#include "check_assertion.h"
17
18template <typename StreamT>
19inline void test_native_handle_assertion() {
20 StreamT f;
21
22 // non-const
23 TEST_LIBCPP_ASSERT_FAILURE(f.native_handle(), "File must be opened");
24 // const
25 TEST_LIBCPP_ASSERT_FAILURE(std::as_const(f).native_handle(), "File must be opened");
26}
27
28#endif // TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_ASSERT_TEST_HELPERS_H
29

source code of libcxx/test/std/input.output/file.streams/fstreams/native_handle_assert_test_helpers.h