Add support for :all on MooseX::Types::Combine
Kent Fredric [Wed, 24 Aug 2011 07:53:00 +0000 (19:53 +1200)]
add a basic test for :all

Changes
lib/MooseX/Types/Combine.pm
t/18_combined_libs.t

diff --git a/Changes b/Changes
index 4c17e44..3590531 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for MooseX-Types
 
 {{$NEXT}}
+        - Add support for qw( :all ) on MooseX::Types::Combine libraries. (kentnl)
 
 0.29    2011-08-20
         - Require namespace::clean 0.19. Tests fail with 0.18. Reported by
index 73e1e20..010f15a 100644 (file)
@@ -33,6 +33,11 @@ sub import {
 
     my %types = $class->_provided_types;
 
+    if ( grep { $_ eq ':all' } @types ){
+      $_->import({ -into => $caller }, q{:all} ) for $class->provide_types_from;
+      return;
+    }
+
     my %from;
     for my $type (@types) {
         unless ($types{$type}) {
index 6ef2191..976d924 100644 (file)
@@ -36,4 +36,6 @@ qr/\Qmain asked for a type (NonExistentType) which is not found in any of the ty
     'cannot combine types from a package which does not exist';
 }
 
+is exception { 'Combined'->import(':all') }, undef, ':all syntax works';
+
 done_testing();