X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FTest%2FMouse.pm;h=a9583bf6428550a9893ca3a1ca900e186f8cb0e5;hb=f3e1112299b631f1ab6150159eaa414dca37a42c;hp=34697ebb1524d40d6052d05ca6c923b2679a6785;hpb=73e9153a57c2adfd533a0ac5a3ad843ebfd4c7e7;p=gitmo%2FMouse.git diff --git a/lib/Test/Mouse.pm b/lib/Test/Mouse.pm index 34697eb..a9583bf 100644 --- a/lib/Test/Mouse.pm +++ b/lib/Test/Mouse.pm @@ -10,6 +10,7 @@ Mouse::Exporter->setup_import_methods( meta_ok does_ok has_attribute_ok + with_immutable )], ); @@ -60,6 +61,20 @@ sub has_attribute_ok ($$;$) { } } +sub with_immutable (&@) { + 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__