Properly return a syntax error instead of segfaulting if each/keys/values is used...
[p5sagit/p5-mst-13.2.git] / t / op / filetest.t
index c46bdc1..4659c70 100644 (file)
@@ -18,9 +18,15 @@ ok( !-f 'op' );
 ok( !-d 'TEST' );
 ok( -r 'TEST' );
 
-# make sure TEST is r-x
-eval { chmod 0555, 'TEST' or die "chmod 0555, 'TEST' failed: $!" };
-chomp ($bad_chmod = $@);
+# Make a read only file
+my $ro_file = tempfile();
+
+{
+    open my $fh, '>', $ro_file or die "open $fh: $!";
+    close $fh or die "close $fh: $!";
+}
+
+chmod 0555, $ro_file or die "chmod 0555, '$ro_file' failed: $!";
 
 $oldeuid = $>;         # root can read and write anything
 eval '$> = 1';         # so switch uid (may not be implemented)
@@ -31,14 +37,8 @@ SKIP: {
     if (!$Config{d_seteuid}) {
        skip('no seteuid');
     } 
-    elsif ($Config{config_args} =~/Dmksymlinks/) {
-       skip('we cannot chmod symlinks');
-    }
-    elsif ($bad_chmod) {
-       skip( $bad_chmod );
-    }
     else {
-       ok( !-w 'TEST' );
+       ok( !-w $ro_file );
     }
 }
 
@@ -101,8 +101,9 @@ my $over;
     package OverFtest;
 
     use overload 
+       fallback => 1,
         -X => sub { 
-            $over = [overload::StrVal($_[0]), $_[1]];
+            $over = [qq($_[0]), $_[1]];
             "-$_[1]"; 
         };
 }
@@ -131,11 +132,11 @@ my $over;
 }
 
 my $ft = bless [], "OverFtest";
-my $ftstr = overload::StrVal($ft);
+my $ftstr = qq($ft);
 my $str = bless [], "OverString";
 my $both = bless [], "OverBoth";
 my $neither = bless [], "OverNeither";
-my $nstr = overload::StrVal($neither);
+my $nstr = qq($neither);
 
 open my $gv, "<", "TEST";
 bless $gv, "OverString";