X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=t%2Ftest.pm;h=1a7422945c06df796a1ee8959812b6d33146796f;hb=aa6d2faf4a09834c6d5d5c3cda646697aa346912;hp=b1c85878eeb70e9b10684573bd8f6a93e0788d7f;hpb=156f9d09e37c5162f39d19bd7a3e5f6865325516;p=term-progressbar.git diff --git a/t/test.pm b/t/test.pm index b1c8587..1a74229 100644 --- a/t/test.pm +++ b/t/test.pm @@ -86,8 +86,6 @@ The following symbols are exported upon request: =item evcheck -=item only_files - =item save_output =item restore_output @@ -102,8 +100,7 @@ The following symbols are exported upon request: =cut -@EXPORT_OK = qw( compare evcheck - save_output restore_output tempdir tmpnam ); +@EXPORT_OK = qw( evcheck save_output restore_output ); # Utility ----------------------------- @@ -126,22 +123,10 @@ sub rel2abs { if ( File::Spec->file_name_is_absolute($_[0]) ) { return $_[0]; } else { - return catdir(cwd, $_[0]); + return File::Spec->catdir(cwd, $_[0]); } } -sub catdir { - File::Spec->catdir(@_); -} - -sub catfile { - File::Spec->catfile(@_); -} - -sub updir { - File::Spec->updir(@_); -} - sub min { croak "Can't min over 0 args!\n" unless @_; @@ -158,13 +143,13 @@ sub min { # PACKAGE CONSTANTS # ------------------------------------- -use constant BUILD_SCRIPT_DIR => => catdir $Bin, updir, qw( blib script ); +use constant BUILD_SCRIPT_DIR => => File::Spec->catdir( $Bin, File::Spec->updir, qw( blib script ) ); sub find_exec { my ($exec) = @_; for (split /:/, $PATH) { - my $try = catfile $_, $exec; + my $try = File::Spec->catfile($_, $exec); return rel2abs($try) if -x $try; } @@ -194,69 +179,6 @@ chdir $tmpdn; # PACKAGE FUNCTIONS # ------------------------------------- -=head2 only_files - -=over 4 - -=item ARGUMENTS - -=over 4 - -=item expect - -Arrayref of names of files to expect to exist. - -=back - -=item RETURNS - -=over 4 - -=item ok - -1 if exactly expected files exist, false otherwise. - -=back - -=back - -=cut - -sub only_files { - my ($expect) = @_; - - local *MYDIR; - opendir MYDIR, '.'; - my %files = map { $_ => 1 } readdir MYDIR; - closedir MYDIR; - - my $ok = 1; - - for (@$expect, '.', '..') { - if ( exists $files{$_} ) { - delete $files{$_}; - } elsif ( ! -e $_ ) { # $_ might be absolute - carp "File not found: $_\n" - if $ENV{TEST_DEBUG}; - $ok = 0; - } - } - - for (keys %files) { - carp "Extra file found: $_\n" - if $ENV{TEST_DEBUG}; - $ok = 0; - } - - if ( $ok ) { - return 1; - } else { - return; - } -} - -# ------------------------------------- - =head2 evcheck Eval code, return status