diff --git a/dist.ini b/dist.ini index f8b9198..a3615a3 100644 --- a/dist.ini +++ b/dist.ini @@ -16,11 +16,11 @@ repository.web = https://github.com/jonswar/perl-chi repository.type = git ; Build -[PruneFiles] -filenames = Makefile.PL [ExecDir] [ExtraTests] [GatherDir] +exclude_filename = Makefile.PL + [License] [MakeMaker] [ManifestSkip] diff --git a/lib/CHI/Test.pm b/lib/CHI/Test.pm index a1fc865..c4c8904 100644 --- a/lib/CHI/Test.pm +++ b/lib/CHI/Test.pm @@ -7,45 +7,36 @@ use List::MoreUtils qw(uniq); use Module::Runtime qw(require_module); use CHI; use CHI::Driver::Memory; +use Import::Into; use strict; use warnings; sub import { my $class = shift; - $class->export_to_level( 1, undef, @_ ); -} -sub packages_to_import { - return ( - qw( - Test::Deep - Test::More - Test::Exception - CHI::Test::Util - ) + # Test::Deep exports way too much by default + 'Test::Deep'->import::into( + 1, qw(eq_deeply cmp_deeply cmp_set cmp_bag + cmp_methods subbagof superbagof subsetof + supersetof superhashof subhashof) + ); + + # Exports all by default + 'Test::More'->import::into(1); + + # Exports all by default + 'Test::Exception'->import::into(1); + + # EXPORT_OK Only + 'CHI::Test::Util'->import::into( + 1, qw(activate_test_logger is_between + cmp_bool random_string skip_until) ); } sub export_to_level { my ( $class, $level, $ignore ) = @_; - - foreach my $package ( $class->packages_to_import() ) { - require_module($package); - my @export; - if ( $package eq 'Test::Deep' ) { - - # Test::Deep exports way too much by default - @export = - qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods subbagof superbagof subsetof supersetof superhashof subhashof); - } - else { - - # Otherwise, grab everything from @EXPORT - no strict 'refs'; - @export = @{"$package\::EXPORT"}; - } - $package->export_to_level( $level + 1, undef, @export ); - } + $class->import::into($level); } 1;