aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2020-09-29 12:13:10 +0200
committerVasil Dimov <vd@FreeBSD.org>2020-10-31 17:02:52 +0100
commit89836a82eec63f93bbe6c3bd6a52be26e71ab54d (patch)
tree88c83651978d9f9917cafe9a5ccbb5459205e50d /src/test
parentec9b4492eba5d32ab833d511984756601d3f39b0 (diff)
style: minor improvements as a followup to #19845
Address suggestions: https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495486760 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495488051 https://github.com/bitcoin/bitcoin/pull/19845#discussion_r495730125
Diffstat (limited to 'src/test')
-rw-r--r--src/test/util/setup_common.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h
index a09c8c122d..1812ce1666 100644
--- a/src/test/util/setup_common.h
+++ b/src/test/util/setup_common.h
@@ -11,6 +11,7 @@
#include <node/context.h>
#include <pubkey.h>
#include <random.h>
+#include <stdexcept>
#include <txmempool.h>
#include <util/check.h>
#include <util/string.h>
@@ -158,13 +159,15 @@ std::ostream& operator<<(std::ostream& os, const uint256& num);
* Use as
* BOOST_CHECK_EXCEPTION(code that throws, exception type, HasReason("foo"));
*/
-class HasReason {
+class HasReason
+{
public:
explicit HasReason(const std::string& reason) : m_reason(reason) {}
- template <typename E>
- bool operator() (const E& e) const {
+ bool operator()(const std::exception& e) const
+ {
return std::string(e.what()).find(m_reason) != std::string::npos;
};
+
private:
const std::string m_reason;
};