Unicode properties: fix L& (the #12319 didn't allow L&,
[p5sagit/p5-mst-13.2.git] / t / op / chdir.t
index 9ad9921..c668494 100644 (file)
@@ -8,16 +8,24 @@ BEGIN {
 }
 
 require "test.pl";
-plan(tests => 25);
+plan(tests => 31);
 
 my $IsVMS = $^O eq 'VMS';
 
+my ($saved_sys_login);
+BEGIN {
+    $saved_sys_login = $ENV{'SYS$LOGIN'} if $^O eq 'VMS'
+}
+END {
+    $ENV{'SYS$LOGIN'} = $saved_sys_login if $^O eq 'VMS';
+}
+
 # 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);
 
 # 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);
 }
@@ -44,7 +52,7 @@ sub check_env {
     if( $key eq 'SYS$LOGIN' && !$IsVMS ) {
         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" );
@@ -80,18 +88,26 @@ WARNING
     }
 }
 
+sub clean_env {
+    delete $ENV{$_} foreach @magic_envs;
+    # The following means we won't really be testing for non-existence,
+    # but in Perl we can only delete from the process table, not the job 
+    # table.
+    $ENV{'SYS$LOGIN'} = '' if $IsVMS;
+}
+
 foreach my $key (@magic_envs) {
     # We're going to be using undefs a lot here.
     no warnings 'uninitialized';
 
-    local %ENV = () if !$IsVMS;
+    clean_env;
     $ENV{$key} = catdir $Cwd, ($IsVMS ? 'OP' : 'op');
     
     check_env($key);
 }
 
 {
-    local %ENV = () if !$IsVMS;
+    clean_env;
 
     ok( !chdir(),                   'chdir() w/o any ENV set' );
     is( abs_path, $Cwd,             '  abs_path() agrees' );