sub with_immutable (&@) {
my $block = shift;
my $before = $Test->current_test;
+ my $passing_before = (Test::Builder->VERSION < 1.005 ? 0 : $Test->history->pass_count) || 0;
+
$block->();
Class::MOP::class_of($_)->make_immutable for @_;
$block->();
+
my $num_tests = $Test->current_test - $before;
- return all { $_ } ($Test->summary)[-$num_tests..-1];
+ my $all_passed = Test::Builder->VERSION < 1.005
+ ? all { $_ } ($Test->summary)[-$num_tests..-1]
+ : $num_tests == $Test->history->pass_count - $passing_before;
+ return $all_passed;
}
1;