| 19 | namespace tests { |
| 20 | |
| 21 | TEST(PD_THROW, empty) { |
| 22 | bool caught_exception = false; |
| 23 | try { |
| 24 | PD_THROW(); |
| 25 | } catch (const std::exception& e) { |
| 26 | caught_exception = true; |
| 27 | std::string err_msg = e.what(); |
| 28 | EXPECT_TRUE(err_msg.find("An error occurred.") != std::string::npos); |
| 29 | #if _WIN32 |
| 30 | EXPECT_TRUE(err_msg.find("test\\cpp\\phi\\api\\test_phi_exception.cc") != |
| 31 | std::string::npos); |
| 32 | #else |
| 33 | EXPECT_TRUE(err_msg.find("test/cpp/phi/api/test_phi_exception.cc") != |
| 34 | std::string::npos); |
| 35 | #endif |
| 36 | } |
| 37 | EXPECT_TRUE(caught_exception); |
| 38 | } |
| 39 | |
| 40 | TEST(PD_THROW, non_empty) { |
| 41 | bool caught_exception = false; |