meta_ok
does_ok
has_attribute_ok
+ with_immutable
)],
);
## exported functions
-sub meta_ok ($;$) {
+sub meta_ok ($;$) { ## no critic
my ($class_or_obj, $message) = @_;
$message ||= "The object has a meta";
}
}
-sub does_ok ($$;$) {
+sub does_ok ($$;$) { ## no critic
my ($class_or_obj, $does, $message) = @_;
$message ||= "The object does $does";
}
}
-sub has_attribute_ok ($$;$) {
+sub has_attribute_ok ($$;$) { ## no critic
my ($class_or_obj, $attr_name, $message) = @_;
$message ||= "The object does has an attribute named $attr_name";
}
}
+sub with_immutable (&@) { ## no critic
+ my $block = shift;
+
+ my $before = $Test->current_test;
+
+ $block->();
+ $_->meta->make_immutable for @_;
+ $block->();
+
+ my $num_tests = $Test->current_test - $before;
+
+ return !grep{ !$_ } ($Test->summary)[-$num_tests .. -1];
+}
+
1;
__END__