Open drmuey opened 6 years ago
unless that violates the spec then I guess this is a noop :)
If the behavior described in #48 is the intent then this can be closed because you can accomplish this (and without out the state of each test affecting the others) w/ something like:
around {
my $cnt = 0;
my $chk_cnt = 0;
no warnings "redefine";
local $X::Y::reformat_harddrive = sub { $cnt++ };
local $X::Y::check_harddrive = sub { $chk_cnt++ };
use warnings "redefine";
yield;
$cnt = 0;
$chk_cnt = 0;
};
a more realistic example might be:
around {
my $mocked_module = Test::MockModule->new(…);
$mocked_module->redefine(…);
$mocked_module->redefine(…);
$mocked_module->redefine(…);
yield;
$mocked_module->unmock_all();
};
Greetings!
Conceptually, what I want to do is something like this:
In Test::Spec I have to kind of simulate local() vars to do this:
Two problems with that:
it*()
local()
via before/after all is fragileIt’d be really cool to be able to call around like before/after, like so: