summaryrefslogtreecommitdiff
path: root/lib/File/Find/t/find.t
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2007-10-23 03:39:19 +0000
committerCraig A. Berry <craigberry@mac.com>2007-10-23 03:39:19 +0000
commitdd87e51f1a7ecb68f4d69f1547da6cacf6b8c31f (patch)
tree900e4e923f0b5356b7a4a3a0f37d2b6a9448382b /lib/File/Find/t/find.t
parent215ed6ce53e595830ca9877085cf6bb6381f9211 (diff)
downloadperl-dd87e51f1a7ecb68f4d69f1547da6cacf6b8c31f.tar.gz
Make the File::Find tests stay under t/ where they
belong (the first call to cleanup() was leaving us at the top of the Perl source tree). p4raw-id: //depot/perl@32175
Diffstat (limited to 'lib/File/Find/t/find.t')
-rw-r--r--lib/File/Find/t/find.t16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/File/Find/t/find.t b/lib/File/Find/t/find.t
index 404086e5fb..33e5264098 100644
--- a/lib/File/Find/t/find.t
+++ b/lib/File/Find/t/find.t
@@ -1,11 +1,12 @@
#!./perl
-
+use strict;
+use Cwd;
my %Expect_File = (); # what we expect for $_
my %Expect_Name = (); # what we expect for $File::Find::name/fullname
my %Expect_Dir = (); # what we expect for $File::Find::dir
my $symlink_exists = eval { symlink("",""); 1 };
-my $warn_msg;
+my ($warn_msg, @files, $file);
BEGIN {
@@ -18,6 +19,8 @@ BEGIN {
if ( $symlink_exists ) { print "1..199\n"; }
else { print "1..85\n"; }
+my $orig_dir = cwd();
+
# Uncomment this to see where File::Find is chdir'ing to. Helpful for
# debugging its little jaunts around the filesystem.
# BEGIN {
@@ -73,8 +76,10 @@ my $case = 2;
my $FastFileTests_OK = 0;
sub cleanup {
+ chdir($orig_dir);
+ my $need_updir = 0;
if (-d dir_path('for_find')) {
- chdir(dir_path('for_find'));
+ $need_updir = 1 if chdir(dir_path('for_find'));
}
if (-d dir_path('fa')) {
unlink file_path('fa', 'fa_ord'),
@@ -91,7 +96,10 @@ sub cleanup {
rmdir dir_path('fb', 'fba');
rmdir dir_path('fb');
}
- chdir(File::Spec->updir);
+ if ($need_updir) {
+ my $updir = $^O eq 'VMS' ? File::Spec::VMS->updir() : File::Spec->updir;
+ chdir($updir);
+ }
if (-d dir_path('for_find')) {
rmdir dir_path('for_find') or print "# Can't rmdir for_find: $!\n";
}