misterg | c2e7548 | 2017-09-19 16:54:40 -0400 | [diff] [blame] | 1 | // Testing utilities for ABSL types which throw exceptions. |
| 2 | |
| 3 | #ifndef ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_ |
| 4 | #define ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_ |
| 5 | |
| 6 | #include "gtest/gtest.h" |
| 7 | #include "absl/base/config.h" |
| 8 | |
| 9 | // ABSL_BASE_INTERNAL_EXPECT_FAIL tests either for a specified thrown exception |
| 10 | // if exceptions are enabled, or for death with a specified text in the error |
| 11 | // message |
| 12 | #ifdef ABSL_HAVE_EXCEPTIONS |
| 13 | |
| 14 | #define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \ |
| 15 | EXPECT_THROW(expr, exception_t) |
| 16 | |
| 17 | #else |
| 18 | |
| 19 | #define ABSL_BASE_INTERNAL_EXPECT_FAIL(expr, exception_t, text) \ |
| 20 | EXPECT_DEATH(expr, text) |
| 21 | |
| 22 | #endif |
| 23 | |
| 24 | #endif // ABSL_BASE_INTERNAL_EXCEPTION_TESTING_H_ |