use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More;
use Test::Exception;
-BEGIN {
- use_ok('Moose::Util::TypeConstraints');
- use_ok('Moose::Meta::TypeConstraint::Parameterized');
+BEGIN {
+ use_ok('Moose::Util::TypeConstraints');
+ use_ok('Moose::Meta::TypeConstraint::Parameterized');
}
# Array of Ints
), '... [[ 1, 2, 3 ], [ qw/foo bar/ ]] failed successfully');
{
- package AutoDeref;
- use Moose;
- use Moose::Util::TypeConstraints;
-
- has 'bar' => (
- is => 'rw',
- isa => 'ArrayRef[Int]',
- auto_deref => 1,
- );
-}
-
-my $autoderef = AutoDeref->new;
-lives_ok { $autoderef->bar(1, 2, 3) };
-is_deeply [ $autoderef->bar ], [1, 2, 3];
+ my $anon_type = Moose::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Foo]');
+ isa_ok( $anon_type, 'Moose::Meta::TypeConstraint::Parameterized' );
-dies_ok { $autoderef->bar(1, "foo", 3) };
+ my $param_type = $anon_type->type_parameter;
+ isa_ok( $param_type, 'Moose::Meta::TypeConstraint::Class' );
+}
+done_testing;