1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <system_error>
11 
12 // class system_error
13 
14 // system_error(int ev, const error_category& ecat, const string& what_arg);
15 
16 // Test is slightly non-portable
17 
18 #include <system_error>
19 #include <string>
20 #include <cassert>
21 
main()22 int main()
23 {
24     std::string what_arg("test message");
25     std::system_error se(static_cast<int>(std::errc::not_a_directory),
26                          std::generic_category(), what_arg);
27     assert(se.code() == std::make_error_code(std::errc::not_a_directory));
28     std::string what_message(se.what());
29     assert(what_message.find(what_arg) != std::string::npos);
30     assert(what_message.find("Not a directory") != std::string::npos);
31 }
32