use strict;
use warnings;
-use Test::More tests => 86;
+use Test::More;
use Test::Exception;
{
package FooRole;
use Moose::Role;
+ our $VERSION = 23;
+
has 'bar' => ( is => 'rw', isa => 'FooClass' );
has 'baz' => ( is => 'ro' );
use Moose;
extends 'BarClass';
- with 'FooRole';
+
+ ::throws_ok { with 'FooRole' => { -version => 42 } }
+ qr/FooRole version 42 required--this is only version 23/,
+ 'applying role with unsatisfied version requirement';
+
+ ::lives_ok { with 'FooRole' => { -version => 13 } }
+ 'applying role with satisfied version requirement';
sub blau {'FooClass::blau'} # << the role wraps this ...
is( $foo->bar, $foo2, '... got the right value for bar now' );
}
+
+done_testing;