From: Dave Rolsky Date: Sat, 26 Feb 2011 18:55:49 +0000 (-0600) Subject: Move role tests to a separate file and skip with Moose pre 1.99 X-Git-Tag: v0.05~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-FollowPBP.git;a=commitdiff_plain;h=0cef3678652428dd706e9a8369fc8a2963988537 Move role tests to a separate file and skip with Moose pre 1.99 --- diff --git a/t/basic.t b/t/basic.t index 8f6c1ca..c14d332 100644 --- a/t/basic.t +++ b/t/basic.t @@ -64,21 +64,4 @@ ok( ! PBP3->can('set_thing2'), 'PBP3->set_thing2 does not exist' ); ok( !PBP4->can('get_bare'), 'is => bare attribute is respected' ); ok( !PBP4->can('set_bare'), 'is => bare attribute is respected' ); -{ - package PBP::Role; - use Moose::Role; - use MooseX::FollowPBP; - has foo => (is => 'rw'); -} - -{ - package PBP::WithRole; - use Moose; - with 'PBP::Role'; -} - -ok( PBP::WithRole->can('get_foo'), "works in a role" ); -ok( PBP::WithRole->can('set_foo'), "works in a role" ); -ok( !PBP::WithRole->can('foo'), "works in a role" ); - done_testing(); diff --git a/t/role.t b/t/role.t new file mode 100644 index 0000000..e17868c --- /dev/null +++ b/t/role.t @@ -0,0 +1,39 @@ +use strict; +use warnings; + +use Test::More; + +use Moose (); + +plan skip_all => 'This test requires Moose 1.9900+' + unless $Moose::VERSION ge '1.9900'; + +{ + package Role::SAA; + + use Moose::Role; + use MooseX::FollowPBP; + + has 'foo' => ( is => 'rw' ); + has '_bar' => ( is => 'rw' ); +} + +{ + package Class; + + use Moose; + + with 'Role::SAA'; + + has 'thing' => ( is => 'rw' ); + has '_private' => ( is => 'rw' ); +} + +can_ok( 'Class', 'thing' ); +ok( ! Class->can('set_thing') ); +can_ok( 'Class', '_private' ); +ok( ! Class->can('_set_private') ); + +can_ok( 'Class', qw( get_foo set_foo _get_bar _set_bar ) ); + +done_testing();