Re: Smoke [5.9.3] 25093 FAIL(F) openbsd 3.7 (macppc/1 cpu)
[p5sagit/p5-mst-13.2.git] / t / io / open.t
index e71d2ec..f08eed5 100755 (executable)
@@ -12,7 +12,7 @@ use Config;
 $Is_VMS = $^O eq 'VMS';
 $Is_MacOS = $^O eq 'MacOS';
 
-plan tests => 105;
+plan tests => 108;
 
 my $Perl = which_perl();
 
@@ -234,15 +234,19 @@ 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: {
     skip "This perl uses perlio", 1 if $Config{useperlio};
-    skip "This system doesn't understand EINVAL", 1 unless exists $!{EINVAL};
+    skip "miniperl cannot be relied on to load %Errno"
+       if $ENV{PERL_CORE_MINITEST};
+    # Force the reference to %! to be run time by writing ! as {"!"}
+    skip "This system doesn't understand EINVAL", 1
+       unless exists ${"!"}{EINVAL};
 
     no warnings 'io';
-    ok( !open(F,'>',\my $s) && $!{EINVAL}, 'open(reference) raises EINVAL' );
+    ok(!open(F,'>',\my $s) && ${"!"}{EINVAL}, 'open(reference) raises EINVAL');
 }
 
 {
@@ -302,3 +306,18 @@ SKIP: {
         'bad layer ":c" failure');
 }
 
+# [perl #28986] "open m" crashes Perl
+
+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");