From: Arthur Axel 'fREW' Schmidt Date: Sat, 5 Sep 2009 08:22:39 +0000 (-0500) Subject: meta tests for 020 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e96e76e29da2735f5a309d58972836ee8da794b;p=gitmo%2FMoose.git meta tests for 020 --- diff --git a/t/010_basics/012_rebless.t b/t/010_basics/012_rebless.t index 238833f..e64f2c0 100644 --- a/t/010_basics/012_rebless.t +++ b/t/010_basics/012_rebless.t @@ -86,7 +86,7 @@ skip_meta { 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'; } 7; -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/020_attributes/004_attribute_triggers.t b/t/020_attributes/004_attribute_triggers.t index baa2a2a..7433b02 100644 --- a/t/020_attributes/004_attribute_triggers.t +++ b/t/020_attributes/004_attribute_triggers.t @@ -3,11 +3,15 @@ use strict; use warnings; +use lib 't/lib'; + use Scalar::Util 'isweak'; use Test::More tests => 42; use Test::Exception; +use MetaTest; + { @@ -167,7 +171,7 @@ use Test::Exception; our @calls; has foo => (is => 'rw', trigger => sub { push @calls, [@_] }); } - +skip_meta { { my $attr = Foo->meta->get_attribute('foo'); @@ -210,4 +214,5 @@ use Test::Exception; Foo->meta->make_immutable, redo if Foo->meta->is_mutable; } +} 6; diff --git a/t/020_attributes/007_attribute_custom_metaclass.t b/t/020_attributes/007_attribute_custom_metaclass.t index 25c3d1b..4a75216 100644 --- a/t/020_attributes/007_attribute_custom_metaclass.t +++ b/t/020_attributes/007_attribute_custom_metaclass.t @@ -3,9 +3,14 @@ use strict; use warnings; -use Test::More tests => 16; +use lib 't/lib'; + +use Test::More; use Test::Exception; +use MetaTest; + +skip_all_meta 16; { diff --git a/t/020_attributes/009_attribute_inherited_slot_specs.t b/t/020_attributes/009_attribute_inherited_slot_specs.t index 62c1958..abdd53e 100644 --- a/t/020_attributes/009_attribute_inherited_slot_specs.t +++ b/t/020_attributes/009_attribute_inherited_slot_specs.t @@ -3,9 +3,12 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 84; use Test::Exception; +use MetaTest; { @@ -187,78 +190,78 @@ is($bar->baz, undef, '... got the right undef default value'); } # check some meta-stuff - -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'); - +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; diff --git a/t/020_attributes/010_attribute_delegation.t b/t/020_attributes/010_attribute_delegation.t index 95bd73c..e5f5ebb 100644 --- a/t/020_attributes/010_attribute_delegation.t +++ b/t/020_attributes/010_attribute_delegation.t @@ -3,9 +3,12 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 92; use Test::Exception; +use MetaTest; # ------------------------------------------------------------------- @@ -43,11 +46,12 @@ isa_ok($bar, 'Bar'); ok($bar->foo, '... we have something in bar->foo'); isa_ok($bar->foo, 'Foo'); -my $meth = Bar->meta->get_method('foo_bar'); -isa_ok($meth, 'Moose::Meta::Method::Delegation'); -is($meth->associated_attribute->name, 'foo', - 'associated_attribute->name for this method is foo'); - +skip_meta { + my $meth = Bar->meta->get_method('foo_bar'); + isa_ok($meth, 'Moose::Meta::Method::Delegation'); + is($meth->associated_attribute->name, 'foo', + 'associated_attribute->name for this method is foo'); +} 2; is($bar->foo->bar, 10, '... bar->foo->bar returned the right default'); can_ok($bar, 'foo_bar'); @@ -415,9 +419,11 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop'); ); } my $i = Quux->new; - ok($i->meta->has_method('foo_bar'), 'handles method foo_bar is present'); - $i->meta->remove_attribute('foo'); - ok(!$i->meta->has_method('foo_bar'), 'handles method foo_bar is removed'); + skip_meta { + ok($i->meta->has_method('foo_bar'), 'handles method foo_bar is present'); + $i->meta->remove_attribute('foo'); + ok(!$i->meta->has_method('foo_bar'), 'handles method foo_bar is removed'); + } 2; } # Make sure that a useful error message is thrown when the delegation target is diff --git a/t/020_attributes/011_more_attr_delegation.t b/t/020_attributes/011_more_attr_delegation.t index 99a3b40..afa2237 100644 --- a/t/020_attributes/011_more_attr_delegation.t +++ b/t/020_attributes/011_more_attr_delegation.t @@ -3,9 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 39; use Test::Exception; +use MetaTest; + =pod This tests the more complex @@ -199,9 +203,10 @@ is( $p->child_a_method_2, "ChildA a2", "delegates are their own invocants" ); can_ok( $p, "child_b_method_1" ); ok( !$p->can("child_b_method_2"), "but not ChildB's unspecified siblings" ); - +skip_meta { ok( !$p->can($_), "none of ChildD's methods ($_)" ) for grep { /^child/ } map { $_->name } ChildD->meta->get_all_methods(); + } 2; can_ok( $p, "child_c_method_3_la" ); can_ok( $p, "child_c_method_4_la" ); diff --git a/t/020_attributes/012_misc_attribute_tests.t b/t/020_attributes/012_misc_attribute_tests.t index b788d7c..4daa618 100644 --- a/t/020_attributes/012_misc_attribute_tests.t +++ b/t/020_attributes/012_misc_attribute_tests.t @@ -3,9 +3,12 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 47; use Test::Exception; +use MetaTest; { @@ -21,16 +24,17 @@ use Test::Exception; is => 'bare', ); } - - my $foo_attr = Test::Attribute::Inline::Documentation->meta->get_attribute('foo'); - - ok($foo_attr->has_documentation, '... the foo has docs'); - is($foo_attr->documentation, - q{ - The 'foo' attribute is my favorite - attribute in the whole wide world. - }, - '... got the foo docs'); + skip_meta { + my $foo_attr = Test::Attribute::Inline::Documentation->meta->get_attribute('foo'); + + ok($foo_attr->has_documentation, '... the foo has docs'); + is($foo_attr->documentation, + q{ + The 'foo' attribute is my favorite + attribute in the whole wide world. + }, + '... got the foo docs'); + } 2; } { @@ -173,16 +177,17 @@ use Test::Exception; has 'foo' => ( required => 1, builder => 'build_foo', is => 'ro'); sub build_foo { return "works" }; } + skip_meta { + my $meta = Test::Builder::Attribute->meta; + my $foo_attr = $meta->get_attribute("foo"); - my $meta = Test::Builder::Attribute->meta; - my $foo_attr = $meta->get_attribute("foo"); - - ok($foo_attr->is_required, "foo is required"); - ok($foo_attr->has_builder, "foo has builder"); - is($foo_attr->builder, "build_foo", ".. and it's named build_foo"); + ok($foo_attr->is_required, "foo is required"); + ok($foo_attr->has_builder, "foo has builder"); + is($foo_attr->builder, "build_foo", ".. and it's named build_foo"); - my $instance = Test::Builder::Attribute->new; - is($instance->foo, 'works', "foo builder works"); + my $instance = Test::Builder::Attribute->new; + is($instance->foo, 'works', "foo builder works"); + } 4; } { @@ -211,34 +216,36 @@ use Test::Exception; sub _build__foo { return "works too" }; } - my $meta = Test::LazyBuild::Attribute->meta; - my $foo_attr = $meta->get_attribute("foo"); - my $_foo_attr = $meta->get_attribute("_foo"); + skip_meta { + my $meta = Test::LazyBuild::Attribute->meta; + my $foo_attr = $meta->get_attribute("foo"); + my $_foo_attr = $meta->get_attribute("_foo"); - ok($foo_attr->is_lazy, "foo is lazy"); - ok($foo_attr->is_lazy_build, "foo is lazy_build"); + ok($foo_attr->is_lazy, "foo is lazy"); + ok($foo_attr->is_lazy_build, "foo is lazy_build"); - ok($foo_attr->has_clearer, "foo has clearer"); - is($foo_attr->clearer, "clear_foo", ".. and it's named clear_foo"); + ok($foo_attr->has_clearer, "foo has clearer"); + is($foo_attr->clearer, "clear_foo", ".. and it's named clear_foo"); - ok($foo_attr->has_builder, "foo has builder"); - is($foo_attr->builder, "_build_foo", ".. and it's named build_foo"); + ok($foo_attr->has_builder, "foo has builder"); + is($foo_attr->builder, "_build_foo", ".. and it's named build_foo"); - ok($foo_attr->has_predicate, "foo has predicate"); - is($foo_attr->predicate, "has_foo", ".. and it's named has_foo"); + ok($foo_attr->has_predicate, "foo has predicate"); + is($foo_attr->predicate, "has_foo", ".. and it's named has_foo"); - ok($_foo_attr->is_lazy, "_foo is lazy"); - ok(!$_foo_attr->is_required, "lazy_build attributes are no longer automatically required"); - ok($_foo_attr->is_lazy_build, "_foo is lazy_build"); + ok($_foo_attr->is_lazy, "_foo is lazy"); + ok(!$_foo_attr->is_required, "lazy_build attributes are no longer automatically required"); + ok($_foo_attr->is_lazy_build, "_foo is lazy_build"); - ok($_foo_attr->has_clearer, "_foo has clearer"); - is($_foo_attr->clearer, "_clear_foo", ".. and it's named _clear_foo"); + ok($_foo_attr->has_clearer, "_foo has clearer"); + is($_foo_attr->clearer, "_clear_foo", ".. and it's named _clear_foo"); - ok($_foo_attr->has_builder, "_foo has builder"); - is($_foo_attr->builder, "_build__foo", ".. and it's named _build_foo"); + ok($_foo_attr->has_builder, "_foo has builder"); + is($_foo_attr->builder, "_build__foo", ".. and it's named _build_foo"); - ok($_foo_attr->has_predicate, "_foo has predicate"); - is($_foo_attr->predicate, "_has_foo", ".. and it's named _has_foo"); + ok($_foo_attr->has_predicate, "_foo has predicate"); + is($_foo_attr->predicate, "_has_foo", ".. and it's named _has_foo"); + } 17; my $instance = Test::LazyBuild::Attribute->new; ok(!$instance->has_foo, "noo foo value yet"); @@ -259,10 +266,10 @@ use Test::Exception; lives_ok { OutOfClassTest::has('foo', is => 'bare'); } 'create attr via direct sub call'; lives_ok { OutOfClassTest->can('has')->('bar', is => 'bare'); } 'create attr via can'; - -ok(OutOfClassTest->meta->get_attribute('foo'), 'attr created from sub call'); -ok(OutOfClassTest->meta->get_attribute('bar'), 'attr created from can'); - +skip_meta { + ok(OutOfClassTest->meta->get_attribute('foo'), 'attr created from sub call'); + ok(OutOfClassTest->meta->get_attribute('bar'), 'attr created from can'); +} 2; { { diff --git a/t/020_attributes/015_attribute_traits.t b/t/020_attributes/015_attribute_traits.t index fc40435..15f2600 100644 --- a/t/020_attributes/015_attribute_traits.t +++ b/t/020_attributes/015_attribute_traits.t @@ -3,10 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 12; use Test::Exception; use Test::Moose; +use MetaTest; { @@ -53,16 +56,17 @@ is($c->gorch, 10, '... got the right value for gorch'); 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; diff --git a/t/020_attributes/016_attribute_traits_registered.t b/t/020_attributes/016_attribute_traits_registered.t index 91dc88a..5fd69c6 100644 --- a/t/020_attributes/016_attribute_traits_registered.t +++ b/t/020_attributes/016_attribute_traits_registered.t @@ -3,10 +3,13 @@ use strict; use warnings; +use lib 't/lib'; + use Test::More tests => 23; use Test::Exception; use Test::Moose; +use MetaTest; { @@ -82,15 +85,16 @@ is($c->bar, 100, '... got the right value for bar'); can_ok($c, 'baz') and 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'); -is($bar_attr->foo, "blah", "attr initialized"); - -ok(!$bar_attr->meta->does_role('Aliased'), "does_role ignores aliases for sanity"); -ok($bar_attr->does('Aliased'), "attr->does uses aliases"); -ok(!$bar_attr->meta->does_role('Fictional'), "does_role returns false for nonexistent roles"); -ok(!$bar_attr->does('Fictional'), "attr->does returns false for nonexistent roles"); +skip_meta { + my $bar_attr = $c->meta->get_attribute('bar'); + does_ok($bar_attr, 'My::Attribute::Trait'); + is($bar_attr->foo, "blah", "attr initialized"); + ok(!$bar_attr->meta->does_role('Aliased'), "does_role ignores aliases for sanity"); + ok($bar_attr->does('Aliased'), "attr->does uses aliases"); + ok(!$bar_attr->meta->does_role('Fictional'), "does_role returns false for nonexistent roles"); + ok(!$bar_attr->does('Fictional'), "attr->does returns false for nonexistent roles"); +} 6; my $quux = My::Derived::Class->new(bar => 1000); is($quux->bar, 1000, '... got the right value for bar'); @@ -98,20 +102,21 @@ is($quux->bar, 1000, '... got the right value for bar'); can_ok($quux, 'baz'); is($quux->baz, 1000, '... got the right value for baz'); -my $derived_bar_attr = $quux->meta->get_attribute("bar"); -does_ok($derived_bar_attr, 'My::Attribute::Trait' ); - -is( $derived_bar_attr->foo, "blah", "attr initialized" ); +skip_meta { + my $derived_bar_attr = $quux->meta->get_attribute("bar"); + does_ok($derived_bar_attr, 'My::Attribute::Trait' ); -does_ok($derived_bar_attr, 'My::Other::Attribute::Trait' ); + is( $derived_bar_attr->foo, "blah", "attr initialized" ); -is($derived_bar_attr->the_other_attr, "oink", "attr initialized" ); + does_ok($derived_bar_attr, 'My::Other::Attribute::Trait' ); -ok(!$derived_bar_attr->meta->does_role('Aliased'), "does_role ignores aliases for sanity"); -ok($derived_bar_attr->does('Aliased'), "attr->does uses aliases"); -ok(!$derived_bar_attr->meta->does_role('Fictional'), "does_role returns false for nonexistent roles"); -ok(!$derived_bar_attr->does('Fictional'), "attr->does returns false for nonexistent roles"); + is($derived_bar_attr->the_other_attr, "oink", "attr initialized" ); + ok(!$derived_bar_attr->meta->does_role('Aliased'), "does_role ignores aliases for sanity"); + ok($derived_bar_attr->does('Aliased'), "attr->does uses aliases"); + ok(!$derived_bar_attr->meta->does_role('Fictional'), "does_role returns false for nonexistent roles"); + ok(!$derived_bar_attr->does('Fictional'), "attr->does returns false for nonexistent roles"); +} 8; can_ok($quux, 'additional_method'); is(eval { $quux->additional_method }, 42, '... got the right value for additional_method'); diff --git a/t/020_attributes/017_attribute_traits_n_meta.t b/t/020_attributes/017_attribute_traits_n_meta.t index 2aa1114..1a2dd01 100644 --- a/t/020_attributes/017_attribute_traits_n_meta.t +++ b/t/020_attributes/017_attribute_traits_n_meta.t @@ -3,10 +3,15 @@ use strict; use warnings; -use Test::More tests => 7; +use lib 't/lib'; + +use Test::More; use Test::Exception; use Test::Moose; +use MetaTest; + +skip_all_meta 7; { diff --git a/t/020_attributes/022_legal_options_for_inheritance.t b/t/020_attributes/022_legal_options_for_inheritance.t index c44b7d1..f7bbef4 100644 --- a/t/020_attributes/022_legal_options_for_inheritance.t +++ b/t/020_attributes/022_legal_options_for_inheritance.t @@ -2,9 +2,14 @@ use strict; use warnings; -use Test::More tests => 2; +use lib 't/lib'; +use Test::More; + +use MetaTest; + +skip_all_meta 2; { package Bar::Meta::Attribute; diff --git a/t/020_attributes/024_attribute_traits_parameterized.t b/t/020_attributes/024_attribute_traits_parameterized.t index 8b473e5..323adff 100644 --- a/t/020_attributes/024_attribute_traits_parameterized.t +++ b/t/020_attributes/024_attribute_traits_parameterized.t @@ -1,7 +1,14 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 5; + +use lib 't/lib'; + +use Test::More; + +use MetaTest; + +skip_all_meta 5; { package My::Attribute::Trait; diff --git a/t/020_attributes/026_attribute_without_any_methods.t b/t/020_attributes/026_attribute_without_any_methods.t index e932718..a8f1dcf 100644 --- a/t/020_attributes/026_attribute_without_any_methods.t +++ b/t/020_attributes/026_attribute_without_any_methods.t @@ -3,11 +3,17 @@ use strict; use warnings; -use Test::More tests => 2; +use lib 't/lib'; + +use Test::More; use Moose (); use Moose::Meta::Class; +use MetaTest; + +skip_all_meta 2; + my $meta = Moose::Meta::Class->create('Banana'); my $warn; diff --git a/t/020_attributes/027_accessor_override_method.t b/t/020_attributes/027_accessor_override_method.t index 16ab21a..6e171b2 100644 --- a/t/020_attributes/027_accessor_override_method.t +++ b/t/020_attributes/027_accessor_override_method.t @@ -1,12 +1,17 @@ #!/usr/bin/env perl use strict; use warnings; + +use lib 't/lib'; + use Test::More; +use MetaTest; + BEGIN { eval "use Test::Output;"; plan skip_all => "Test::Output is required for this test" if $@; - plan tests => 5; + skip_all_meta 5; } {