MCPcopy Create free account
hub / github.com/boostorg/filesystem / exception_tests

Function exception_tests

test/path_test.cpp:113–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111 // exception_tests -----------------------------------------------------------------//
112
113 void exception_tests()
114 {
115 std::cout << "exception_tests..." << std::endl;
116 const std::string str_1("string-1");
117 boost::system::error_code ec(12345, boost::system::system_category());
118 try { throw fs::filesystem_error(str_1, ec); }
119 catch (const fs::filesystem_error & ex)
120 {
121 //std::cout << ex.what() << "*" << std::endl;
122 //BOOST_TEST(std::strcmp(ex.what(),
123 // "string-1: Unknown error") == 0);
124 BOOST_TEST(ex.code() == ec);
125 }
126
127 try { throw fs::filesystem_error(str_1, "p1", "p2", ec); }
128 catch (const fs::filesystem_error & ex)
129 {
130 //std::cout << ex.what() << "*" << std::endl;
131 //BOOST_TEST(std::strcmp(ex.what(),
132 // "string-1: Unknown error: \"p1\", \"p2\"") == 0);
133 BOOST_TEST(ex.code() == ec);
134 BOOST_TEST(ex.path1() == "p1");
135 BOOST_TEST(ex.path2() == "p2");
136 }
137 }
138
139 // overload_tests ------------------------------------------------------------------//
140

Callers 1

cpp_mainFunction · 0.70

Calls 1

filesystem_errorFunction · 0.85

Tested by

no test coverage detected