use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 11;
+ use Test::More;
use Test::Exception;
use Scalar::Util 'blessed';
$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;
use Moose::Meta::Class;
+use MetaTest;
+
- skip_all_meta 8;
++skip_all_meta 9;
+
{
package Class;
use Moose;
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 { } );
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;
Foo->meta->make_immutable, redo if Foo->meta->is_mutable;
}
+} 6;
+
+ done_testing;
use Test::More;
use Test::Exception;
+use MetaTest;
+
+skip_all_meta 16;
-
{
package Foo::Meta::Attribute;
use Moose;
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;
}
# 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;
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 92;
+ use Test::More;
use Test::Exception;
+use MetaTest;
-
# -------------------------------------------------------------------
# HASH handles
# -------------------------------------------------------------------
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;
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;
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;
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;
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 14;
+ use Test::More;
use Test::Exception;
+use MetaTest;
-
{
package Foo::Role;
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.
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 15;
+ use Test::More;
use Test::Exception;
+use MetaTest;
+
=pod
NOTE:
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
use Scalar::Util qw(blessed);
+use MetaTest;
+
- skip_all_meta 27;
-
++skip_all_meta 28;
=pod
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;
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;
} '... 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;
use Test::More;
use Test::Exception;
+use MetaTest;
-
{
package My::Role;
use Moose::Role;
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;
$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;
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;
$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;
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;
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;
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
ClassWithoutBUILD->meta->make_immutable;
redo;
}
-}
+ }
+} 3*2;
+ done_testing;
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 17;
+ use Test::More;
+use MetaTest;
{
package Role::Foo;
use Test::More;
use Test::Exception;
+use MetaTest;
+
+skip_all_meta 3;
-
{
package My::Custom::Meta::Attr;
use Moose;
use Test::More;
use Test::Exception;
+use MetaTest;
+
+skip_all_meta 4;
+
-
=pod
This test demonstrates that Moose will respect
use Test::More;
use Test::Exception;
+use MetaTest;
+
+skip_all_meta 16;
+
-
=pod
This test demonstrates the ability to extend
use Test::More;
use Test::Exception;
+use MetaTest;
+
+skip_all_meta 7;
+
-
BEGIN {
package MyFramework::Base;
use Moose;
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
use Test::More;
use Test::Exception;
+use MetaTest;
+
+skip_all_meta 6;
+
-
{
package Elk;
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;
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;
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;
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;
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 68;
+ use Test::More;
use Test::Exception;
use Test::Moose 'does_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;
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 46;
+ use Test::More;
use Test::Exception;
use Test::Moose 'does_ok';
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;
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;
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 43;
+ use Test::More;
use Test::Exception;
use Test::Moose 'does_ok';
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;
# 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;
use strict;
use warnings;
+use lib 't/lib';
+
- use Test::More tests => 3;
+ use Test::More;
+use MetaTest;
+
{
package Foo;
use Moose;
{
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;