From: Arthur Axel 'fREW' Schmidt Date: Thu, 18 Feb 2010 01:14:23 +0000 (-0600) Subject: merge in latest moose changes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2739446a3b7e24ba1a7d6e29d25f4a76c6cd6775;p=gitmo%2FMoose.git merge in latest moose changes --- 2739446a3b7e24ba1a7d6e29d25f4a76c6cd6775 diff --cc t/010_basics/012_rebless.t index 09e46dc,77ed3eb..809fe98 --- a/t/010_basics/012_rebless.t +++ b/t/010_basics/012_rebless.t @@@ -3,9 -3,7 +3,9 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 11; + use Test::More; use Test::Exception; use Scalar::Util 'blessed'; @@@ -77,16 -71,17 +77,17 @@@ skip_meta $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"); - -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) } -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'; +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"); + + 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'; +} 5; + done_testing; diff --cc t/010_basics/014_create_anon.t index 5e0468e,978c40a..d48a11b --- a/t/010_basics/014_create_anon.t +++ b/t/010_basics/014_create_anon.t @@@ -9,10 -7,6 +9,10 @@@ use Test::More use Moose::Meta::Class; +use MetaTest; + - skip_all_meta 8; ++skip_all_meta 9; + { package Class; use Moose; diff --cc t/010_basics/018_methods.t index 24090f8,aa3bb4b..87b4dbc --- a/t/010_basics/018_methods.t +++ b/t/010_basics/018_methods.t @@@ -3,13 -3,8 +3,12 @@@ use strict; use warnings; +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 { } ); diff --cc t/020_attributes/004_attribute_triggers.t index 59b417d,b8ec580..f20c46e --- a/t/020_attributes/004_attribute_triggers.t +++ b/t/020_attributes/004_attribute_triggers.t @@@ -3,17 -3,12 +3,16 @@@ use strict; use warnings; +use lib 't/lib'; + use Scalar::Util 'isweak'; - use Test::More tests => 43; + use Test::More; use Test::Exception; +use MetaTest; + - { package Foo; use Moose; @@@ -223,5 -218,4 +222,6 @@@ skip_meta Foo->meta->make_immutable, redo if Foo->meta->is_mutable; } +} 6; + + done_testing; diff --cc t/020_attributes/007_attribute_custom_metaclass.t index 4a75216,58c1ec1..e90d44e --- a/t/020_attributes/007_attribute_custom_metaclass.t +++ b/t/020_attributes/007_attribute_custom_metaclass.t @@@ -8,11 -6,7 +8,10 @@@ use lib 't/lib' use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 16; - { package Foo::Meta::Attribute; use Moose; diff --cc t/020_attributes/009_attribute_inherited_slot_specs.t index abdd53e,593c9d4..3f6edff --- a/t/020_attributes/009_attribute_inherited_slot_specs.t +++ b/t/020_attributes/009_attribute_inherited_slot_specs.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 84; + use Test::More; use Test::Exception; +use MetaTest; - { package Thing; use Moose; @@@ -190,78 -186,78 +189,80 @@@ is($bar->baz, undef, '... got the righ } # check some meta-stuff +skip_meta { + ok(Bar->meta->has_attribute('foo'), '... Bar has a foo attr'); + ok(Bar->meta->has_attribute('bar'), '... Bar has a bar attr'); + ok(Bar->meta->has_attribute('baz'), '... Bar has a baz attr'); + ok(Bar->meta->has_attribute('gorch'), '... Bar has a gorch attr'); + ok(Bar->meta->has_attribute('gloum'), '... Bar has a gloum attr'); + ok(Bar->meta->has_attribute('bling'), '... Bar has a bling attr'); + ok(Bar->meta->has_attribute('bunch_of_stuff'), '... Bar does have a bunch_of_stuff attr'); + ok(!Bar->meta->has_attribute('blang'), '... Bar has a blang attr'); + ok(Bar->meta->has_attribute('fail'), '... Bar has a fail attr'); + ok(!Bar->meta->has_attribute('other_fail'), '... Bar does not have an other_fail attr'); + + isnt(Foo->meta->get_attribute('foo'), + Bar->meta->get_attribute('foo'), + '... Foo and Bar have different copies of foo'); + isnt(Foo->meta->get_attribute('bar'), + Bar->meta->get_attribute('bar'), + '... Foo and Bar have different copies of bar'); + isnt(Foo->meta->get_attribute('baz'), + Bar->meta->get_attribute('baz'), + '... Foo and Bar have different copies of baz'); + isnt(Foo->meta->get_attribute('gorch'), + Bar->meta->get_attribute('gorch'), + '... Foo and Bar have different copies of gorch'); + isnt(Foo->meta->get_attribute('gloum'), + Bar->meta->get_attribute('gloum'), + '... Foo and Bar have different copies of gloum'); + isnt(Foo->meta->get_attribute('bling'), + Bar->meta->get_attribute('bling'), + '... Foo and Bar have different copies of bling'); + isnt(Foo->meta->get_attribute('bunch_of_stuff'), + Bar->meta->get_attribute('bunch_of_stuff'), + '... Foo and Bar have different copies of bunch_of_stuff'); + + ok(Bar->meta->get_attribute('bar')->has_type_constraint, + '... Bar::bar inherited the type constraint too'); + ok(Bar->meta->get_attribute('baz')->has_type_constraint, + '... Bar::baz inherited the type constraint too'); + + is(Bar->meta->get_attribute('bar')->type_constraint->name, + 'Str', '... Bar::bar inherited the right type constraint too'); + + is(Foo->meta->get_attribute('baz')->type_constraint->name, + 'Ref', '... Foo::baz inherited the right type constraint too'); + is(Bar->meta->get_attribute('baz')->type_constraint->name, + 'ArrayRef', '... Bar::baz inherited the right type constraint too'); + + ok(!Foo->meta->get_attribute('gorch')->is_required, + '... Foo::gorch is not a required attr'); + ok(Bar->meta->get_attribute('gorch')->is_required, + '... Bar::gorch is a required attr'); + + is(Foo->meta->get_attribute('bunch_of_stuff')->type_constraint->name, + 'ArrayRef', + '... Foo::bunch_of_stuff is an ArrayRef'); + is(Bar->meta->get_attribute('bunch_of_stuff')->type_constraint->name, + 'ArrayRef[Int]', + '... Bar::bunch_of_stuff is an ArrayRef[Int]'); + + ok(!Foo->meta->get_attribute('gloum')->is_lazy, + '... Foo::gloum is not a required attr'); + ok(Bar->meta->get_attribute('gloum')->is_lazy, + '... Bar::gloum is a required attr'); + + ok(!Foo->meta->get_attribute('foo')->should_coerce, + '... Foo::foo should not coerce'); + ok(Bar->meta->get_attribute('foo')->should_coerce, + '... Bar::foo should coerce'); + + ok(!Foo->meta->get_attribute('bling')->has_handles, + '... Foo::foo should not handles'); + ok(Bar->meta->get_attribute('bling')->has_handles, + '... Bar::foo should handles'); +} 32; -ok(Bar->meta->has_attribute('foo'), '... Bar has a foo attr'); -ok(Bar->meta->has_attribute('bar'), '... Bar has a bar attr'); -ok(Bar->meta->has_attribute('baz'), '... Bar has a baz attr'); -ok(Bar->meta->has_attribute('gorch'), '... Bar has a gorch attr'); -ok(Bar->meta->has_attribute('gloum'), '... Bar has a gloum attr'); -ok(Bar->meta->has_attribute('bling'), '... Bar has a bling attr'); -ok(Bar->meta->has_attribute('bunch_of_stuff'), '... Bar does have a bunch_of_stuff attr'); -ok(!Bar->meta->has_attribute('blang'), '... Bar has a blang attr'); -ok(Bar->meta->has_attribute('fail'), '... Bar has a fail attr'); -ok(!Bar->meta->has_attribute('other_fail'), '... Bar does not have an other_fail attr'); - -isnt(Foo->meta->get_attribute('foo'), - Bar->meta->get_attribute('foo'), - '... Foo and Bar have different copies of foo'); -isnt(Foo->meta->get_attribute('bar'), - Bar->meta->get_attribute('bar'), - '... Foo and Bar have different copies of bar'); -isnt(Foo->meta->get_attribute('baz'), - Bar->meta->get_attribute('baz'), - '... Foo and Bar have different copies of baz'); -isnt(Foo->meta->get_attribute('gorch'), - Bar->meta->get_attribute('gorch'), - '... Foo and Bar have different copies of gorch'); -isnt(Foo->meta->get_attribute('gloum'), - Bar->meta->get_attribute('gloum'), - '... Foo and Bar have different copies of gloum'); -isnt(Foo->meta->get_attribute('bling'), - Bar->meta->get_attribute('bling'), - '... Foo and Bar have different copies of bling'); -isnt(Foo->meta->get_attribute('bunch_of_stuff'), - Bar->meta->get_attribute('bunch_of_stuff'), - '... Foo and Bar have different copies of bunch_of_stuff'); - -ok(Bar->meta->get_attribute('bar')->has_type_constraint, - '... Bar::bar inherited the type constraint too'); -ok(Bar->meta->get_attribute('baz')->has_type_constraint, - '... Bar::baz inherited the type constraint too'); - -is(Bar->meta->get_attribute('bar')->type_constraint->name, - 'Str', '... Bar::bar inherited the right type constraint too'); - -is(Foo->meta->get_attribute('baz')->type_constraint->name, - 'Ref', '... Foo::baz inherited the right type constraint too'); -is(Bar->meta->get_attribute('baz')->type_constraint->name, - 'ArrayRef', '... Bar::baz inherited the right type constraint too'); - -ok(!Foo->meta->get_attribute('gorch')->is_required, - '... Foo::gorch is not a required attr'); -ok(Bar->meta->get_attribute('gorch')->is_required, - '... Bar::gorch is a required attr'); - -is(Foo->meta->get_attribute('bunch_of_stuff')->type_constraint->name, - 'ArrayRef', - '... Foo::bunch_of_stuff is an ArrayRef'); -is(Bar->meta->get_attribute('bunch_of_stuff')->type_constraint->name, - 'ArrayRef[Int]', - '... Bar::bunch_of_stuff is an ArrayRef[Int]'); - -ok(!Foo->meta->get_attribute('gloum')->is_lazy, - '... Foo::gloum is not a required attr'); -ok(Bar->meta->get_attribute('gloum')->is_lazy, - '... Bar::gloum is a required attr'); - -ok(!Foo->meta->get_attribute('foo')->should_coerce, - '... Foo::foo should not coerce'); -ok(Bar->meta->get_attribute('foo')->should_coerce, - '... Bar::foo should coerce'); - -ok(!Foo->meta->get_attribute('bling')->has_handles, - '... Foo::foo should not handles'); -ok(Bar->meta->get_attribute('bling')->has_handles, - '... Bar::foo should handles'); + + done_testing; diff --cc t/020_attributes/010_attribute_delegation.t index e5f5ebb,16ec30e..c21a055 --- a/t/020_attributes/010_attribute_delegation.t +++ b/t/020_attributes/010_attribute_delegation.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 92; + use Test::More; use Test::Exception; +use MetaTest; - # ------------------------------------------------------------------- # HASH handles # ------------------------------------------------------------------- diff --cc t/020_attributes/012_misc_attribute_tests.t index 5d521cd,80c2330..e927284 --- a/t/020_attributes/012_misc_attribute_tests.t +++ b/t/020_attributes/012_misc_attribute_tests.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 47; + use Test::More; use Test::Exception; +use MetaTest; - { { package Test::Attribute::Inline::Documentation; diff --cc t/020_attributes/015_attribute_traits.t index 15f2600,428919e..b4304ca --- a/t/020_attributes/015_attribute_traits.t +++ b/t/020_attributes/015_attribute_traits.t @@@ -3,15 -3,11 +3,14 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 12; + use Test::More; use Test::Exception; use Test::Moose; +use MetaTest; - { package My::Attribute::Trait; use Moose::Role; @@@ -56,17 -52,15 +55,17 @@@ is($c->gorch, 10, '... got the right va can_ok($c, 'baz'); is($c->baz, 100, '... got the right value for baz'); -my $bar_attr = $c->meta->get_attribute('bar'); -does_ok($bar_attr, 'My::Attribute::Trait'); -ok($bar_attr->has_applied_traits, '... got the applied traits'); -is_deeply($bar_attr->applied_traits, [qw/My::Attribute::Trait/], '... got the applied traits'); -is($bar_attr->foo, "blah", "attr initialized"); - -my $gorch_attr = $c->meta->get_attribute('gorch'); -ok(!$gorch_attr->does('My::Attribute::Trait'), '... gorch doesnt do the trait'); -ok(!$gorch_attr->has_applied_traits, '... no traits applied'); -is($gorch_attr->applied_traits, undef, '... no traits applied'); +skip_meta { + my $bar_attr = $c->meta->get_attribute('bar'); + does_ok($bar_attr, 'My::Attribute::Trait'); + ok($bar_attr->has_applied_traits, '... got the applied traits'); + is_deeply($bar_attr->applied_traits, [qw/My::Attribute::Trait/], '... got the applied traits'); + is($bar_attr->foo, "blah", "attr initialized"); + + my $gorch_attr = $c->meta->get_attribute('gorch'); + ok(!$gorch_attr->does('My::Attribute::Trait'), '... gorch doesnt do the trait'); + ok(!$gorch_attr->has_applied_traits, '... no traits applied'); + is($gorch_attr->applied_traits, undef, '... no traits applied'); +} 7; - + done_testing; diff --cc t/020_attributes/016_attribute_traits_registered.t index 5fd69c6,14cd0df..193c3ed --- a/t/020_attributes/016_attribute_traits_registered.t +++ b/t/020_attributes/016_attribute_traits_registered.t @@@ -3,15 -3,11 +3,14 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 23; + use Test::More; use Test::Exception; use Test::Moose; +use MetaTest; - { package My::Attribute::Trait; use Moose::Role; diff --cc t/030_roles/004_role_composition_errors.t index a16eea2,b2c58f4..1938652 --- a/t/030_roles/004_role_composition_errors.t +++ b/t/030_roles/004_role_composition_errors.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 14; + use Test::More; use Test::Exception; +use MetaTest; - { package Foo::Role; diff --cc t/030_roles/005_role_conflict_detection.t index 36eb649,d33b1c0..2adf000 --- a/t/030_roles/005_role_conflict_detection.t +++ b/t/030_roles/005_role_conflict_detection.t @@@ -3,13 -3,9 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 88; + use Test::More; use Test::Exception; +use MetaTest; + =pod Mutually recursive roles. diff --cc t/030_roles/007_roles_and_req_method_edge_cases.t index e6cc74b,bdbcf45..1a9a303 --- a/t/030_roles/007_roles_and_req_method_edge_cases.t +++ b/t/030_roles/007_roles_and_req_method_edge_cases.t @@@ -3,13 -3,9 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 15; + use Test::More; use Test::Exception; +use MetaTest; + =pod NOTE: diff --cc t/030_roles/009_more_role_edge_cases.t index c69e7be,4a4fde0..9a54bc8 --- a/t/030_roles/009_more_role_edge_cases.t +++ b/t/030_roles/009_more_role_edge_cases.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 74; + use Test::More; use Test::Exception; +use MetaTest; - { # NOTE: # this tests that repeated role diff --cc t/030_roles/010_run_time_role_composition.t index f9848a4,a1dfd7c..faea39e --- a/t/030_roles/010_run_time_role_composition.t +++ b/t/030_roles/010_run_time_role_composition.t @@@ -9,10 -7,6 +9,9 @@@ use Test::More use Scalar::Util qw(blessed); +use MetaTest; + - skip_all_meta 27; - ++skip_all_meta 28; =pod diff --cc t/030_roles/011_overriding.t index 347e518,300a39f..6afad5e --- a/t/030_roles/011_overriding.t +++ b/t/030_roles/011_overriding.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 39; + use Test::More; use Test::Exception; +use MetaTest; - { # test no conflicts here package Role::A; diff --cc t/030_roles/012_method_exclusion_in_composition.t index 0f6dae7,fa74523..074a94c --- a/t/030_roles/012_method_exclusion_in_composition.t +++ b/t/030_roles/012_method_exclusion_in_composition.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 19; + use Test::More; use Test::Exception; +use MetaTest; - { package My::Role; use Moose::Role; @@@ -117,10 -107,7 +116,9 @@@ skip_meta } '... composed our roles correctly'; } -ok(!My::Foo::Role::Other->meta->has_method('foo'), "we dont have a foo method"); -ok(My::Foo::Role::Other->meta->requires_method('foo'), '... and the &foo method is required'); +skip_meta { + ok(!My::Foo::Role::Other->meta->has_method('foo'), "we dont have a foo method"); + ok(My::Foo::Role::Other->meta->requires_method('foo'), '... and the &foo method is required'); +} 2; - - + done_testing; diff --cc t/030_roles/013_method_aliasing_in_composition.t index 1153708,6487561..f891119 --- a/t/030_roles/013_method_aliasing_in_composition.t +++ b/t/030_roles/013_method_aliasing_in_composition.t @@@ -8,9 -6,7 +8,8 @@@ use lib 't/lib' use Test::More; use Test::Exception; +use MetaTest; - { package My::Role; use Moose::Role; diff --cc t/030_roles/015_runtime_roles_and_attrs.t index fb2caac,865e252..e102a1b --- a/t/030_roles/015_runtime_roles_and_attrs.t +++ b/t/030_roles/015_runtime_roles_and_attrs.t @@@ -3,16 -3,11 +3,14 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 11; + use Test::More; use Test::Exception; use Scalar::Util 'blessed'; +use MetaTest; - - { package Dog; use Moose::Role; @@@ -45,18 -40,18 +43,20 @@@ dies_ok $obj->dog($obj) } '... and setting the accessor fails (not a Dog yet)'; -Dog->meta->apply($obj); +skip_meta { + Dog->meta->apply($obj); -ok($obj->does('Dog'), '... we now do the Bark role'); -ok($obj->can('talk'), "... the role is now composed at the object level"); -ok($obj->can('fur'), "it has fur"); + ok($obj->does('Dog'), '... we now do the Bark role'); + ok($obj->can('talk'), "... the role is now composed at the object level"); + ok($obj->can('fur'), "it has fur"); -is($obj->talk, 'woof', '... got the right return value for the newly composed method'); + is($obj->talk, 'woof', '... got the right return value for the newly composed method'); -lives_ok { - $obj->dog($obj) -} '... and setting the accessor is okay'; + lives_ok { + $obj->dog($obj) + } '... and setting the accessor is okay'; -is($obj->fur, "dirty", "role attr initialized"); + is($obj->fur, "dirty", "role attr initialized"); +} 6; + + done_testing; diff --cc t/030_roles/016_runtime_roles_and_nonmoose.t index c77d785,ec4e657..c068df4 --- a/t/030_roles/016_runtime_roles_and_nonmoose.t +++ b/t/030_roles/016_runtime_roles_and_nonmoose.t @@@ -3,16 -3,11 +3,14 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 7; + use Test::More; use Test::Exception; use Scalar::Util 'blessed'; +use MetaTest; - - { package Dog; use Moose::Role; @@@ -48,14 -43,14 +46,16 @@@ dies_ok $foo->dog($bar) } '... and setting the accessor fails (not a Dog yet)'; -Dog->meta->apply($bar); +skip_meta { + Dog->meta->apply($bar); -ok($bar->can('talk'), "... the role is now composed at the object level"); + ok($bar->can('talk'), "... the role is now composed at the object level"); -is($bar->talk, 'woof', '... got the right return value for the newly composed method'); + is($bar->talk, 'woof', '... got the right return value for the newly composed method'); -lives_ok { - $foo->dog($bar) -} '... and setting the accessor is okay'; + lives_ok { + $foo->dog($bar) + } '... and setting the accessor is okay'; +} 3; + + done_testing; diff --cc t/030_roles/018_runtime_roles_w_params.t index 3a1ba35,0ca57ed..852e102 --- a/t/030_roles/018_runtime_roles_w_params.t +++ b/t/030_roles/018_runtime_roles_w_params.t @@@ -3,14 -3,10 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 21; + use Test::More; use Test::Exception; +use MetaTest; - { package Foo; use Moose; @@@ -68,15 -60,13 +67,15 @@@ is($foo->bar, 'BAR', '... got the expect value'); ok(!$foo->can('baz'), '... no baz method though'); - lives_ok { - Bar->meta->apply($foo, (rebless_params => { bar => 'FOO-BAR', baz => 'FOO-BAZ' })) - } '... this works'; + skip_meta { + lives_ok { + Bar->meta->apply($foo, (rebless_params => { bar => 'FOO-BAR', baz => 'FOO-BAZ' })) + } '... this works'; - is($foo->bar, 'FOO-BAR', '... got the expect value'); - ok($foo->can('baz'), '... we have baz method now'); - is($foo->baz, 'FOO-BAZ', '... got the expect value'); + is($foo->bar, 'FOO-BAR', '... got the expect value'); + ok($foo->can('baz'), '... we have baz method now'); + is($foo->baz, 'FOO-BAZ', '... got the expect value'); + } 4; } - + done_testing; diff --cc t/030_roles/019_build.t index 5154209,1dfc912..7bd1edf --- a/t/030_roles/019_build.t +++ b/t/030_roles/019_build.t @@@ -9,11 -5,8 +9,10 @@@ use Test::More BEGIN { eval "use Test::Output;"; plan skip_all => "Test::Output is required for this test" if $@; - plan tests => 8; } +use MetaTest; + # this test script ensures that my idiom of: # role: sub BUILD, after BUILD # continues to work to run code after object initialization, whether the class @@@ -83,6 -75,6 +82,7 @@@ skip_meta ClassWithoutBUILD->meta->make_immutable; redo; } -} + } +} 3*2; + done_testing; diff --cc t/030_roles/032_roles_and_method_cloning.t index 9f2c4f6,2b52bca..88b7470 --- a/t/030_roles/032_roles_and_method_cloning.t +++ b/t/030_roles/032_roles_and_method_cloning.t @@@ -3,11 -3,8 +3,11 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 17; + use Test::More; +use MetaTest; { package Role::Foo; diff --cc t/050_metaclasses/001_custom_attr_meta_with_roles.t index 4f1c7c8,a2d1495..69b21ff --- a/t/050_metaclasses/001_custom_attr_meta_with_roles.t +++ b/t/050_metaclasses/001_custom_attr_meta_with_roles.t @@@ -8,11 -6,7 +8,10 @@@ use lib 't/lib' use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 3; - { package My::Custom::Meta::Attr; use Moose; diff --cc t/050_metaclasses/003_moose_w_metaclass.t index 040034e,0749068..47692e9 --- a/t/050_metaclasses/003_moose_w_metaclass.t +++ b/t/050_metaclasses/003_moose_w_metaclass.t @@@ -8,12 -6,7 +8,11 @@@ use lib 't/lib' use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 4; + - =pod This test demonstrates that Moose will respect diff --cc t/050_metaclasses/004_moose_for_meta.t index 8632247,bd415ee..8f892c6 --- a/t/050_metaclasses/004_moose_for_meta.t +++ b/t/050_metaclasses/004_moose_for_meta.t @@@ -8,12 -6,7 +8,11 @@@ use lib 't/lib' use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 16; + - =pod This test demonstrates the ability to extend diff --cc t/050_metaclasses/010_extending_and_embedding_back_compat.t index 144ed0f,4f0f142..e5b0bc0 --- a/t/050_metaclasses/010_extending_and_embedding_back_compat.t +++ b/t/050_metaclasses/010_extending_and_embedding_back_compat.t @@@ -8,12 -6,7 +8,11 @@@ use lib 't/lib' use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 7; + - BEGIN { package MyFramework::Base; use Moose; diff --cc t/060_compat/002_moose_respects_base.t index b357316,71789b3..fa1abc7 --- a/t/060_compat/002_moose_respects_base.t +++ b/t/060_compat/002_moose_respects_base.t @@@ -3,20 -3,10 +3,19 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 6; + use Test::More; use Test::Exception; +use MetaTest; + +# this is so that when we use base 'Foo' below we won't get the Foo.pm in t/lib +BEGIN { + @INC = grep { $_ ne 't/lib' } @INC; +}; + - =pod This test demonstrates that Moose will respect diff --cc t/060_compat/003_foreign_inheritence.t index 2a54fdc,0fdcb9b..494631d --- a/t/060_compat/003_foreign_inheritence.t +++ b/t/060_compat/003_foreign_inheritence.t @@@ -8,12 -6,7 +8,11 @@@ use lib 't/lib' use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 6; + - { package Elk; diff --cc t/070_native_traits/020_remove_attribute.t index d5e9aa3,5e9305d..1daf421 --- a/t/070_native_traits/020_remove_attribute.t +++ b/t/070_native_traits/020_remove_attribute.t @@@ -3,13 -3,9 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 11; + use Test::More; use Test::Exception; +use MetaTest; + { package MyHomePage; use Moose; @@@ -37,20 -33,19 +37,21 @@@ can_ok( $page, $_ ) for qw reset_counter ]; -lives_ok { - $page->meta->remove_attribute('counter'); -} -'... removed the counter attribute okay'; - -ok( !$page->meta->has_attribute('counter'), - '... no longer has the attribute' ); - -ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[ - counter - dec_counter - inc_counter - reset_counter -]; +skip_meta { + lives_ok { + $page->meta->remove_attribute('counter'); + } + '... removed the counter attribute okay'; + + ok( !$page->meta->has_attribute('counter'), + '... no longer has the attribute' ); + + ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[ + counter + dec_counter + inc_counter + reset_counter + ]; +} 6; + done_testing; diff --cc t/070_native_traits/201_trait_counter.t index 3fc02c3,adb745f..afb67b6 --- a/t/070_native_traits/201_trait_counter.t +++ b/t/070_native_traits/201_trait_counter.t @@@ -3,13 -3,9 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 16; + use Test::More; use Test::Moose 'does_ok'; +use MetaTest; + { package MyHomePage; use Moose; @@@ -62,22 -58,22 +62,24 @@@ $page->dec_counter(5) is( $page->counter, 2, '... decrement by arg' ); # check the meta .. - -my $counter = $page->meta->get_attribute('counter'); -does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' ); - -is( $counter->type_constraint->name, 'Int', - '... got the expected type constraint' ); - -is_deeply( - $counter->handles, - { - inc_counter => 'inc', - dec_counter => 'dec', - reset_counter => 'reset', - set_counter => 'set' - }, - '... got the right handles methods' -); +skip_meta { + my $counter = $page->meta->get_attribute('counter'); + does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' ); + + is( $counter->type_constraint->name, 'Int', + '... got the expected type constraint' ); + + is_deeply( + $counter->handles, + { + inc_counter => 'inc', + dec_counter => 'dec', + reset_counter => 'reset', + set_counter => 'set' + }, + '... got the right handles methods' + ); + +} 3; + + done_testing; diff --cc t/070_native_traits/202_trait_array.t index dbddb59,fc8500f..a217bbe --- a/t/070_native_traits/202_trait_array.t +++ b/t/070_native_traits/202_trait_array.t @@@ -3,9 -3,7 +3,9 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 68; + use Test::More; use Test::Exception; use Test::Moose 'does_ok'; @@@ -245,34 -241,34 +245,35 @@@ dies_ok '... accessor rejects 3 args'; ## test the meta - -my $options = $stuff->meta->get_attribute('options'); -does_ok( $options, 'Moose::Meta::Attribute::Native::Trait::Array' ); - -is_deeply( - $options->handles, - { - 'add_options' => 'push', - 'remove_last_option' => 'pop', - 'remove_first_option' => 'shift', - 'insert_options' => 'unshift', - 'get_option_at' => 'get', - 'set_option_at' => 'set', - 'num_options' => 'count', - 'has_no_options' => 'is_empty', - 'clear_options' => 'clear', - 'splice_options' => 'splice', - 'sort_options_in_place' => 'sort_in_place', - 'option_accessor' => 'accessor', - 'add_options_with_speed' => [ 'push' => 'funrolls', 'funbuns' ], - 'prepend_prerequisites_along_with' => - [ 'unshift' => 'first', 'second' ], - 'descending_options' => [ 'sort_in_place' => $sort ], - }, - '... got the right handles mapping' -); - -is( $options->type_constraint->type_parameter, 'Str', - '... got the right container type' ); +skip_meta { + my $options = $stuff->meta->get_attribute('options'); + does_ok( $options, 'Moose::Meta::Attribute::Native::Trait::Array' ); + + is_deeply( + $options->handles, + { + 'add_options' => 'push', + 'remove_last_option' => 'pop', + 'remove_first_option' => 'shift', + 'insert_options' => 'unshift', + 'get_option_at' => 'get', + 'set_option_at' => 'set', + 'num_options' => 'count', + 'has_no_options' => 'is_empty', + 'clear_options' => 'clear', + 'splice_options' => 'splice', + 'sort_options_in_place' => 'sort_in_place', + 'option_accessor' => 'accessor', + 'add_options_with_speed' => [ 'push' => 'funrolls', 'funbuns' ], + 'prepend_prerequisites_along_with' => + [ 'unshift' => 'first', 'second' ], + 'descending_options' => [ 'sort_in_place' => $sort ], + }, + '... got the right handles mapping' + ); + + is( $options->type_constraint->type_parameter, 'Str', + '... got the right container type' ); +} 3; + done_testing; diff --cc t/070_native_traits/203_trait_hash.t index 1345a5b,1b621b5..ad39d95 --- a/t/070_native_traits/203_trait_hash.t +++ b/t/070_native_traits/203_trait_hash.t @@@ -3,9 -3,7 +3,9 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 46; + use Test::More; use Test::Exception; use Test::Moose 'does_ok'; diff --cc t/070_native_traits/204_trait_number.t index 56eeafa,97a897a..0ead83e --- a/t/070_native_traits/204_trait_number.t +++ b/t/070_native_traits/204_trait_number.t @@@ -3,13 -3,9 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 25; + use Test::More; use Test::Moose; +use MetaTest; + { package Real; use Moose; @@@ -92,26 -88,26 +92,27 @@@ $real->dec is $real->integer, 12, 'dec 13'; ## test the meta - -my $attr = $real->meta->get_attribute('integer'); -does_ok( $attr, 'Moose::Meta::Attribute::Native::Trait::Number' ); - -is_deeply( - $attr->handles, - { - set => 'set', - add => 'add', - sub => 'sub', - mul => 'mul', - div => 'div', - mod => 'mod', - abs => 'abs', - inc => [ add => 1 ], - dec => [ sub => 1 ], - odd => [ mod => 2 ], - cut_in_half => [ div => 2 ], - }, - '... got the right handles mapping' -); +skip_meta { + my $attr = $real->meta->get_attribute('integer'); + does_ok( $attr, 'Moose::Meta::Attribute::Native::Trait::Number' ); + + is_deeply( + $attr->handles, + { + set => 'set', + add => 'add', + sub => 'sub', + mul => 'mul', + div => 'div', + mod => 'mod', + abs => 'abs', + inc => [ add => 1 ], + dec => [ sub => 1 ], + odd => [ mod => 2 ], + cut_in_half => [ div => 2 ], + }, + '... got the right handles mapping' + ); +} 2; + done_testing; diff --cc t/070_native_traits/205_trait_list.t index d337ecc,0501ee7..8c88874 --- a/t/070_native_traits/205_trait_list.t +++ b/t/070_native_traits/205_trait_list.t @@@ -3,9 -3,7 +3,9 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 43; + use Test::More; use Test::Exception; use Test::Moose 'does_ok'; diff --cc t/070_native_traits/207_trait_string.t index 5a403b9,2f3bae9..172d095 --- a/t/070_native_traits/207_trait_string.t +++ b/t/070_native_traits/207_trait_string.t @@@ -3,13 -3,9 +3,13 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 22; + use Test::More; use Test::Moose 'does_ok'; +use MetaTest; + my $uc; { package MyHomePage; @@@ -91,32 -87,31 +91,33 @@@ is( $page->string, '', "clear" ) # check the meta .. -my $string = $page->meta->get_attribute('string'); -does_ok( $string, 'Moose::Meta::Attribute::Native::Trait::String' ); - -is( - $string->type_constraint->name, 'Str', - '... got the expected type constraint' -); - -is_deeply( - $string->handles, - { - inc_string => 'inc', - append_string => 'append', - prepend_string => 'prepend', - match_string => 'match', - replace_string => 'replace', - chop_string => 'chop', - chomp_string => 'chomp', - clear_string => 'clear', - length_string => 'length', - exclaim => [ append => '!' ], - capitalize_last => [ replace => qr/(.)$/, $uc ], - invalid_number => [ match => qr/\D/ ], - }, - '... got the right handles methods' -); +skip_meta { + my $string = $page->meta->get_attribute('string'); + does_ok( $string, 'Moose::Meta::Attribute::Native::Trait::String' ); + + is( + $string->type_constraint->name, 'Str', + '... got the expected type constraint' + ); + + is_deeply( + $string->handles, + { + inc_string => 'inc', + append_string => 'append', + prepend_string => 'prepend', + match_string => 'match', + replace_string => 'replace', + chop_string => 'chop', + chomp_string => 'chomp', + clear_string => 'clear', + length_string => 'length', + exclaim => [ append => '!' ], + capitalize_last => [ replace => qr/(.)$/, $uc ], + invalid_number => [ match => qr/\D/ ], + }, + '... got the right handles methods' + ); +} 3; + done_testing; diff --cc t/100_bugs/007_reader_precedence_bug.t index 766b703,25e3b37..be45ef3 --- a/t/100_bugs/007_reader_precedence_bug.t +++ b/t/100_bugs/007_reader_precedence_bug.t @@@ -3,12 -3,8 +3,12 @@@ use strict; use warnings; +use lib 't/lib'; + - use Test::More tests => 3; + use Test::More; +use MetaTest; + { package Foo; use Moose; @@@ -17,15 -13,11 +17,13 @@@ { my $foo = Foo->new(foo => 10); - my $reader = $foo->meta->get_attribute('foo')->reader; - is($reader, 'get_foo', - 'reader => "get_foo" has correct presedence'); + skip_meta { + my $reader = $foo->meta->get_attribute('foo')->reader; + is($reader, 'get_foo', + 'reader => "get_foo" has correct presedence'); + is($foo->$reader, 10, "Reader works as expected"); + } 2; can_ok($foo, 'get_foo'); - is($foo->$reader, 10, "Reader works as expected"); } - - - + done_testing;