remove trailing whitespace
[gitmo/Moose.git] / t / 040_type_constraints / 011_container_type_constraint.t
index 829d96f..c27d4b8 100644 (file)
@@ -3,12 +3,12 @@
 use strict;
 use warnings;
 
-use Test::More tests => 25;
+use Test::More tests => 24;
 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
@@ -65,20 +65,9 @@ ok(!$array_of_array_of_ints->check(
 ), '... [[ 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];
-
-dies_ok   { $autoderef->bar(1, "foo", 3) };
+    my $anon_type = Moose::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Foo]');
+    isa_ok( $anon_type, 'Moose::Meta::TypeConstraint::Parameterized' );
 
+    my $param_type = $anon_type->type_parameter;
+    isa_ok( $param_type, 'Moose::Meta::TypeConstraint::Class' );
+}