X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Fchdir.t;h=8929069f00861de32b4681a9f2308111193bdad9;hb=e081bb54e0eecfb962e7f0cfd84fcbdb2683d54d;hp=8386df0d45e716cbe77dbb0cc215e99cbcc456e1;hpb=9d4c144b923f1296fc58dd2230c626ac46cfb312;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/chdir.t b/t/op/chdir.t index 8386df0..8929069 100644 --- a/t/op/chdir.t +++ b/t/op/chdir.t @@ -7,29 +7,37 @@ BEGIN { @INC = qw(t . lib ../lib); } +use Config; require "test.pl"; plan(tests => 31); -my $IsVMS = $^O eq 'VMS'; +my $IsVMS = $^O eq 'VMS'; +my $IsMacOS = $^O eq 'MacOS'; # Might be a little early in the testing process to start using these, # but I can't think of a way to write this test without them. -use File::Spec::Functions qw(:DEFAULT splitdir rel2abs); +use File::Spec::Functions qw(:DEFAULT splitdir rel2abs splitpath); # Can't use Cwd::abs_path() because it has different ideas about -# path seperators than File::Spec. +# path separators than File::Spec. sub abs_path { - $IsVMS ? uc(rel2abs(curdir)) : rel2abs(curdir); + my $d = rel2abs(curdir); + + $d = uc($d) if $IsVMS; + $d = lc($d) if $^O =~ /^uwin/; + $d; } my $Cwd = abs_path; # Let's get to a known position SKIP: { - skip("Already in t/", 2) if (splitdir(abs_path))[-1] eq ($IsVMS ? 'T' : 't'); + my ($vol,$dir) = splitpath(abs_path,1); + my $test_dir = $IsVMS ? 'T' : 't'; + skip("Already in t/", 2) if (splitdir($dir))[-1] eq $test_dir; - ok( chdir('t'), 'chdir("t")'); - is( abs_path, catdir($Cwd, 't'), ' abs_path() agrees' ); + ok( chdir($test_dir), 'chdir($test_dir)'); + is( abs_path, catdir($Cwd, $test_dir), ' abs_path() agrees' ); } $Cwd = abs_path; @@ -41,10 +49,10 @@ sub check_env { my($key) = @_; # Make sure $ENV{'SYS$LOGIN'} is only honored on VMS. - if( $key eq 'SYS$LOGIN' && !$IsVMS ) { + if( $key eq 'SYS$LOGIN' && !$IsVMS && !$IsMacOS ) { ok( !chdir(), "chdir() on $^O ignores only \$ENV{$key} set" ); is( abs_path, $Cwd, ' abs_path() did not change' ); - pass( " no need to chdir back on $^O" ); + pass( " no need to test SYS\$LOGIN on $^O" ) for 1..7; } else { ok( chdir(), "chdir() w/ only \$ENV{$key} set" ); @@ -57,42 +65,74 @@ sub check_env { # Check the deprecated chdir(undef) feature. -#line 60 +#line 64 ok( chdir(undef), "chdir(undef) w/ only \$ENV{$key} set" ); is( abs_path, $ENV{$key}, ' abs_path() agrees' ); is( $warning, <