[patch@34016] VMS passes these t/io/open.t tests now.
[p5sagit/p5-mst-13.2.git] / t / io / open.t
index 1871854..68b828a 100755 (executable)
@@ -9,10 +9,9 @@ BEGIN {
 $|  = 1;
 use warnings;
 use Config;
-$Is_VMS = $^O eq 'VMS';
 $Is_MacOS = $^O eq 'MacOS';
 
-plan tests => 106;
+plan tests => 108;
 
 my $Perl = which_perl();
 
@@ -75,10 +74,7 @@ my $Perl = which_perl();
 
     unlink("afile");
 }
-
-SKIP: {
-    skip "open -| busted and noisy on VMS", 3 if $Is_VMS;
-
+{
     ok( open(my $f, '-|', <<EOC),     'open -|' );
     $Perl -e "print qq(a row\\n); print qq(another row\\n)"
 EOC
@@ -87,7 +83,6 @@ EOC
     is( scalar @rows, 2,                '       readline, list context' );
     ok( close($f),                      '       close' );
 }
-
 SKIP: {
     skip "Output for |- doesn't go to shell on MacOS", 5 if $Is_MacOS;
 
@@ -171,9 +166,7 @@ ok( -s 'afile' < 20,                '       -s' );
     unlink("afile");
 }
 
-SKIP: {
-    skip "open -| busted and noisy on VMS", 3 if $Is_VMS;
-
+{
     ok( open(local $f, '-|', <<EOC),  'open local $f, "-|", ...' );
     $Perl -e "print qq(a row\\n); print qq(another row\\n)"
 EOC
@@ -234,7 +227,7 @@ like( $@, qr/Bad filehandle:\s+afile/,          '       right error' );
     }
 
     # used to try to open a file [perl #17830]
-    ok( open(my $stdin,  "<&", fileno STDIN),   'dup fileno(STDIN) into lexical fh');
+    ok( open(my $stdin,  "<&", fileno STDIN),   'dup fileno(STDIN) into lexical fh') or _diag $!;
 }
 
 SKIP: {
@@ -311,3 +304,13 @@ SKIP: {
 fresh_perl_like('open m', qr/^Search pattern not terminated at/,
        { stderr => 1 }, 'open m test');
 
+fresh_perl_is(
+    'sub f { open(my $fh, "xxx"); $fh = "f"; } f; f;print "ok"',
+    'ok', { stderr => 1 },
+    '#29102: Crash on assignment to lexical filehandle');
+
+# [perl #31767] Using $1 as a filehandle via open $1, "file" doesn't raise
+# an exception
+
+eval { open $99, "foo" };
+like($@, qr/Modification of a read-only value attempted/, "readonly fh");