We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7d3899f commit 91b1720Copy full SHA for 91b1720
src/test/util/setup_common.h
@@ -181,11 +181,16 @@ struct TestMemPoolEntryHelper
181
182
CBlock getBlock13b8a();
183
184
-// BOOST_CHECK_EXCEPTION predicates to check the specific validation error
+/**
185
+ * BOOST_CHECK_EXCEPTION predicates to check the specific validation error.
186
+ * Use as
187
+ * BOOST_CHECK_EXCEPTION(code that throws, exception type, HasReason("foo"));
188
+ */
189
class HasReason {
190
public:
191
explicit HasReason(const std::string& reason) : m_reason(reason) {}
- bool operator() (const std::runtime_error& e) const {
192
+ template <typename E>
193
+ bool operator() (const E& e) const {
194
return std::string(e.what()).find(m_reason) != std::string::npos;
195
};
196
private:
0 commit comments