more tests for union types
[gitmo/MooseX-Types.git] / t / lib / DecoratorLibrary.pm
index 374f2b9..6ad113c 100644 (file)
@@ -1,6 +1,6 @@
 package DecoratorLibrary;
 
-use MooseX::Types::Moose qw( Str ArrayRef HashRef Int );
+use MooseX::Types::Moose qw( Str ArrayRef HashRef Int Object);
 use MooseX::Types
     -declare => [qw(
         MyArrayRefBase
@@ -13,6 +13,14 @@ use MooseX::Types
         Jobs
         SubOfMyArrayRefInt01
         BiggerInt
+        isFive
+        isTen
+        isFifteen
+        TwoEqualArrayRefs
+        VeryBigInt
+        FiveOrTenOrFifteen
+        WierdIntergersArrayRef1
+        WierdIntergersArrayRef2
     )];
 
 subtype MyArrayRefBase,
@@ -67,4 +75,28 @@ subtype AtLeastOneInt,
 enum Jobs,
     (qw/Programming Teaching Banking/);
     
+subtype isFive,
+ as Int,
+ where { $_ == 5};
+
+subtype isTen,
+ as Int,
+ where { $_ == 10};
+subtype isFifteen,
+ as Int,
+ where { $_ == 15};
+subtype VeryBigInt,
+ as BiggerInt,
+ where {$_>100};
+subtype FiveOrTenOrFifteen,
+ as isFive|isTen|isFifteen;
+
+subtype WierdIntergersArrayRef1,
+ as ArrayRef[FiveOrTenOrFifteen|VeryBigInt];
+
+subtype WierdIntergersArrayRef2,
+ as ArrayRef[FiveOrTenOrFifteen|Object];    
 1;