- or download this
sub lives_and_tests_ok (&&;$) {
my ($case, $test, $name) = @_;
...
my $result = eval { $case->() };
$@ ? fail($name) : $test->($result, $name);
}
- or download this
lives_and_tests_ok (
sub { $o->answer },
sub { is shift, 42, shift },
"answer is 42"
);
- or download this
sub lives_and_tests_ok (&&;$) {
my ($case, $test, $name) = @_;
...
local ($b, $a) = ($name, eval { $case->() });
$@ ? fail($name) : $test->($result, $name);
}
- or download this
lives_and_tests_ok (
sub { $o->answer },
sub { is $a, 42, $b },
"answer is 42"
);