From: Arthur Axel 'fREW' Schmidt Date: Sat, 5 Sep 2009 06:51:40 +0000 (-0500) Subject: optional meta tests for the rest of 010_basics X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=30ba6fe1a4eabef81f0bac2b304cb2daaf0ad7a9;p=gitmo%2FMoose.git optional meta tests for the rest of 010_basics --- diff --git a/t/010_basics/012_rebless.t b/t/010_basics/012_rebless.t index 04a0880..238833f 100644 --- a/t/010_basics/012_rebless.t +++ b/t/010_basics/012_rebless.t @@ -3,12 +3,16 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 11; use Test::Exception; use Scalar::Util 'blessed'; use Moose::Util::TypeConstraints; +use MetaTest; + subtype 'Positive' => as 'Num' => where { $_ > 0 }; @@ -60,26 +64,29 @@ is($foo->name, undef, 'No name yet'); is($foo->lazy_classname, 'Parent', "lazy attribute initialized"); lives_ok { $foo->type_constrained(10.5) } "Num type constraint for now.."; -# try to rebless, except it will fail due to Child's stricter type constraint -throws_ok { Child->meta->rebless_instance($foo) } -qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 10\.5/, -'... this failed cause of type check'; -throws_ok { Child->meta->rebless_instance($bar) } -qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 5\.5/, -'... this failed cause of type check';; +skip_meta { + # try to rebless, except it will fail due to Child's stricter type constraint + throws_ok { Child->meta->rebless_instance($foo) } + qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 10\.5/, + '... this failed cause of type check'; + throws_ok { Child->meta->rebless_instance($bar) } + qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 5\.5/, + '... this failed cause of type check';; +} 2; $foo->type_constrained(10); $bar->type_constrained(5); -Child->meta->rebless_instance($foo); -Child->meta->rebless_instance($bar); - -is(blessed($foo), 'Child', 'successfully reblessed into Child'); -is($foo->name, 'Junior', "Child->name's default came through"); +skip_meta { + Child->meta->rebless_instance($foo); + Child->meta->rebless_instance($bar); + is(blessed($foo), 'Child', 'successfully reblessed into Child'); + is($foo->name, 'Junior', "Child->name's default came through"); + is($foo->lazy_classname, 'Parent', "lazy attribute was already initialized"); + is($bar->lazy_classname, 'Child', "lazy attribute just now initialized"); -is($foo->lazy_classname, 'Parent', "lazy attribute was already initialized"); -is($bar->lazy_classname, 'Child', "lazy attribute just now initialized"); + throws_ok { $foo->type_constrained(10.5) } +} 7; -throws_ok { $foo->type_constrained(10.5) } qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 10\.5/, '... this failed cause of type check'; diff --git a/t/010_basics/013_create.t b/t/010_basics/013_create.t index a21b37d..f839c96 100644 --- a/t/010_basics/013_create.t +++ b/t/010_basics/013_create.t @@ -3,9 +3,15 @@ use strict; use warnings; -use Test::More tests => 7; +use lib 't/lib'; + +use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 7; + { package Class; use Moose; @@ -24,6 +30,7 @@ use Test::Exception; my $new_class; + lives_ok { $new_class = Moose::Meta::Class->create( 'Class::WithFoo', diff --git a/t/010_basics/014_create_anon.t b/t/010_basics/014_create_anon.t index c75cc81..5e0468e 100644 --- a/t/010_basics/014_create_anon.t +++ b/t/010_basics/014_create_anon.t @@ -3,10 +3,16 @@ use strict; use warnings; -use Test::More tests => 8; +use lib 't/lib'; + +use Test::More; use Moose::Meta::Class; +use MetaTest; + +skip_all_meta 8; + { package Class; use Moose; diff --git a/t/010_basics/018_methods.t b/t/010_basics/018_methods.t index 84fb963..24090f8 100644 --- a/t/010_basics/018_methods.t +++ b/t/010_basics/018_methods.t @@ -3,8 +3,13 @@ use strict; use warnings; -use Test::More tests => 6; +use lib 't/lib'; +use Test::More; + +use MetaTest; + +skip_all_meta 6; my $test1 = Moose::Meta::Class->create_anon_class; $test1->add_method( 'foo1', sub { } );