Upgrade to Unicode::Normalize 0.20.
[p5sagit/p5-mst-13.2.git] / ext / Safe / safe2.t
index 18230e2..3ea19ed 100755 (executable)
@@ -1,8 +1,10 @@
 #!./perl -w
 $|=1;
 BEGIN {
-    chdir 't' if -d 't';
-    @INC = '../lib';
+    if($ENV{PERL_CORE}) {
+       chdir 't' if -d 't';
+       @INC = '../lib';
+    } 
     require Config; import Config;
     if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
         print "1..0\n";
@@ -38,7 +40,7 @@ $cpt = new Safe or die;
 $cpt = new Safe "Root";
 
 $cpt->reval(q{ system("echo not ok 1"); });
-if ($@ =~ /^system trapped by operation mask/) {
+if ($@ =~ /^'?system'? trapped by operation mask/) {
     print "ok 1\n";
 } else {
     print "#$@" if $@;
@@ -118,14 +120,21 @@ print $@ =~ /foo bar/ ? "ok 29\n" : "not ok 29\n";
 
 # --- rdo
   
+my $t = 30;
+$! = 0;
 my $nosuch = '/non/existant/file.name';
 open(NOSUCH, $nosuch);
-my $errno  = $! + 0;
+if ($@) {
+    my $errno  = $!;
+    die "Eek! Attempting to open $nosuch failed, but \$! is still 0" unless $!;
+    $! = 0;
+    $cpt->rdo($nosuch);
+    print $! == $errno ? "ok $t\n" : sprintf "not ok $t # \"$!\" is %d (expected %d)\n", $!, $errno; $t++;
+} else {
+    die "Eek! Didn't expect $nosuch to be there.";
+}
 close(NOSUCH);
 
-my $t = 30;
-$cpt->rdo($nosuch);
-print $! == $errno ? "ok $t\n" : sprintf "not ok $t # \"$!\" is %d (expected %d)\n", $!, $errno; $t++;
 # test #31 is gone.
 print "ok $t\n"; $t++;