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 | // <system_error> |
10 | |
11 | // class system_error |
12 | |
13 | // system_error(error_code ec); |
14 | |
15 | // Test is slightly non-portable |
16 | |
17 | #include <system_error> |
18 | #include <string> |
19 | #include <cassert> |
20 | |
21 | #include "test_macros.h" |
22 | |
23 | int main(int, char**) { |
24 | std::system_error se(static_cast<int>(std::errc::not_a_directory), |
25 | std::generic_category(), "some text"); |
26 | assert(se.code() == std::make_error_code(std::errc::not_a_directory)); |
27 | std::string what_message(se.what()); |
28 | assert(what_message.find("Not a directory") != std::string::npos); |
29 | |
30 | return 0; |
31 | } |
32 |