From: Arthur Axel 'fREW' Schmidt Date: Sat, 5 Sep 2009 05:02:37 +0000 (-0500) Subject: beginning of wrapper code for meta-tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a32f991cc47a292d1c224318fdff56b05814deca;p=gitmo%2FMoose.git beginning of wrapper code for meta-tests --- diff --git a/t/lib/MetaTest.pm b/t/lib/MetaTest.pm new file mode 100644 index 0000000..06db4da --- /dev/null +++ b/t/lib/MetaTest.pm @@ -0,0 +1,30 @@ +package MetaTest; + +use Exporter 'import'; +use Test::More; +our @EXPORT = qw{skip_meta meta_can_ok}; + +sub skip_meta (&$) { + my $fn = shift; + my $amount = shift; + local $Test::Builder::Level = $Test::Builder::Level + 1; + SKIP: { + local $Test::Builder::Level = $Test::Builder::Level + 1; + skip 'meta-tests disabled', $amount if $ENV{SKIP_META_TESTS}; + $fn->(); + }; +} + +sub meta_can_ok { + my $class = shift; + my $method = shift; + my $message = shift; + local $Test::Builder::Level = $Test::Builder::Level + 1; + skip_meta { + local $Test::Builder::Level = $Test::Builder::Level + 1; + ok($class->meta->has_method($method), $message); + ok($class->can($method), $message); + } 1; +} + +1;