| 270 | // exception_tests -----------------------------------------------------------------// |
| 271 | |
| 272 | void exception_tests() |
| 273 | { |
| 274 | std::cout << "exception_tests..." << std::endl; |
| 275 | const std::string str_1("string-1"); |
| 276 | boost::system::error_code ec(12345, boost::system::system_category()); |
| 277 | try |
| 278 | { |
| 279 | throw fs::filesystem_error(str_1, ec); |
| 280 | } |
| 281 | catch (const fs::filesystem_error& ex) |
| 282 | { |
| 283 | //std::cout << ex.what() << "*" << std::endl; |
| 284 | //BOOST_TEST(std::strcmp(ex.what(), |
| 285 | // "string-1: Unknown error") == 0); |
| 286 | BOOST_TEST(ex.code() == ec); |
| 287 | } |
| 288 | |
| 289 | try |
| 290 | { |
| 291 | throw fs::filesystem_error(str_1, "p1", "p2", ec); |
| 292 | } |
| 293 | catch (const fs::filesystem_error& ex) |
| 294 | { |
| 295 | //std::cout << ex.what() << "*" << std::endl; |
| 296 | //BOOST_TEST(std::strcmp(ex.what(), |
| 297 | // "string-1: Unknown error: \"p1\", \"p2\"") == 0); |
| 298 | BOOST_TEST(ex.code() == ec); |
| 299 | BOOST_TEST(ex.path1() == "p1"); |
| 300 | BOOST_TEST(ex.path2() == "p2"); |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | // overload_tests ------------------------------------------------------------------// |
| 305 | |