fix for bug and prep for cpan
[gitmo/MooseX-Types-Structured.git] / t / 12-error.t
index 404716d..2e099fe 100644 (file)
@@ -1,8 +1,6 @@
-BEGIN {
-    use strict;
-    use warnings;
-    use Test::More tests=>27;
-}
+use strict;
+use warnings;
+use Test::More;
 
 use Moose::Util::TypeConstraints;
 use MooseX::Types::Structured qw(Dict Tuple Optional);
@@ -78,7 +76,7 @@ like $optional_tuple->validate(['a','b']),
  'Correctly failed due to "a" not an Int';
 
 like $optional_tuple->validate([1,$simple_tuple]),
- qr/failed for 'MooseX::Types::Structured::Optional\[Str\]' with value MooseX/,
+ qr/failed for 'Optional\[Str\]' with value MooseX/,
  'Correctly failed due to object not a Str';
 
 like $optional_tuple->validate([1,'hello','too many']),
@@ -90,7 +88,7 @@ like $optional_dict->validate([1,2]),
  'Wrong basic type';
 
 like $optional_dict->validate({name=>'John',age=>'a'}),
- qr/Validation failed for 'MooseX::Types::Structured::Optional\[Int\]' with value a/,
+ qr/Validation failed for 'Optional\[Int\]' with value a/,
  'Correctly failed due to age not an Int';
 
 like $optional_dict->validate({name=>$simple_dict,age=>1}),
@@ -119,7 +117,7 @@ ok $deep_tuple->check([1,{a=>2},{name=>'Vincent',age=>15}]),
 {
     my $message = $deep_tuple->validate([1,{a=>2},{name=>'Vincent',age=>'Hello'}]);
     like $message,
-      qr/Validation failed for 'MooseX::Types::Structured::Dict\[name,Str,age,Int\]'/,
+      qr/Validation failed for 'Dict\[name,Str,age,Int\]'/,
       'Example deeper error';
 }
 
@@ -135,35 +133,4 @@ like $deep_tuple->validate([1,{a=>2},{name=>'Vincent1',age=>'Hello1'}]),
 
 ok !$deep_tuple->validate([1,{a=>2},{name=>'John',age=>40}]), 'Validates ok';
 
-## Deeper Tests...
-
-my $deeper_tc = subtype
-  as Dict[
-    a => Tuple[
-        Dict[
-            a1a => Tuple[Int],
-            a1b => Tuple[Int],
-        ],
-        Dict[
-            a2a => Tuple[Int],
-            a2b => Tuple[Int],
-        ],
-    ],
-    b => Tuple[
-        Dict[
-            b1a => Tuple[Int],
-            b1b => Tuple[Int],
-        ],
-        Dict[
-            b2a => Tuple[Int],
-            b2b => Tuple[Int],
-        ],
-    ],
-  ];
-
-{
-    my $message = $deeper_tc->validate({a=>[{a1a=>[1],a1b=>[2]},{a2a=>[3],a2b=>[4]}],b=>[{b1a=>[5],b1b=>['AA']},{b2a=>[7],b2b=>[8]}]});
-    warn $message;
-}
-
-
+done_testing();