* BOOST_CHECK_EXCEPTION predicates to check the specific validation error. * Use as * BOOST_CHECK_EXCEPTION(code that throws, exception type, HasReason("foo")); */
| 227 | * BOOST_CHECK_EXCEPTION(code that throws, exception type, HasReason("foo")); |
| 228 | */ |
| 229 | class HasReason |
| 230 | { |
| 231 | public: |
| 232 | explicit HasReason(const std::string& reason) : m_reason(reason) {} |
| 233 | bool operator()(const std::exception& e) const |
| 234 | { |
| 235 | return std::string(e.what()).find(m_reason) != std::string::npos; |
| 236 | }; |
| 237 | |
| 238 | private: |
| 239 | const std::string m_reason; |
| 240 | }; |
| 241 | |
| 242 | #endif // BITCOIN_TEST_UTIL_SETUP_COMMON_H |
no outgoing calls