use File::Next (); use App::Ack (); sub slurp { my $iter = shift; my @files; while ( defined ( my $file = $iter->() ) ) { push( @files, $file ); } return @files; } sub sets_match { my @expected = @{+shift}; my @actual = @{+shift}; my $msg = shift; # Normalize all the paths for my $path ( @expected, @actual ) { $path = File::Next::reslash( $path ); ## no critic (Variables::ProhibitPackageVars) } local $Test::Builder::Level = $Test::Builder::Level + 1; ## no critic eval 'use Test::Differences'; if ( !$@ ) { return eq_or_diff( [sort @actual], [sort @expected], $msg ); } else { return is_deeply( [sort @actual], [sort @expected], $msg ); } } sub is_filetype { my $filename = shift; my $wanted_type = shift; for my $maybe_type ( App::Ack::filetypes( $filename ) ) { return 1 if $maybe_type eq $wanted_type; } return; } 1;