summaryrefslogtreecommitdiff
path: root/vendor/bandit/specs/fakes/fake_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/bandit/specs/fakes/fake_context.h')
-rw-r--r--vendor/bandit/specs/fakes/fake_context.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/vendor/bandit/specs/fakes/fake_context.h b/vendor/bandit/specs/fakes/fake_context.h
index 1161cfc7..e5d1d870 100644
--- a/vendor/bandit/specs/fakes/fake_context.h
+++ b/vendor/bandit/specs/fakes/fake_context.h
@@ -5,7 +5,8 @@ namespace bandit { namespace fakes {
struct fake_context : public bandit::detail::context, public bandit::specs::logging_fake
{
- fake_context() : hard_skip_(false), name_("fake_context")
+ fake_context() : hard_skip_(false), name_("fake_context"),
+ custom_after_each_([](){}), custom_before_each_([](){})
{}
const std::string& name()
@@ -32,11 +33,13 @@ namespace bandit { namespace fakes {
void run_before_eaches()
{
log() << "run_before_eaches" << std::endl;
+ custom_before_each_();
}
void run_after_eaches()
{
log() << "run_after_eaches" << std::endl;
+ custom_after_each_();
}
bool hard_skip()
@@ -45,9 +48,21 @@ namespace bandit { namespace fakes {
return hard_skip_;
}
+ void with_after_each(detail::voidfunc_t call)
+ {
+ custom_after_each_ = call;
+ }
+
+ void with_before_each(detail::voidfunc_t call)
+ {
+ custom_before_each_ = call;
+ }
+
private:
bool hard_skip_;
std::string name_;
+ detail::voidfunc_t custom_after_each_;
+ detail::voidfunc_t custom_before_each_;
};
}}