clear $ENV{PERL_UNICODE} before runperl()ing a test of use open.
authorTony Cook <tony@develop-help.com>
Mon, 19 Sep 2011 05:20:04 +0000 (15:20 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 19 Sep 2011 05:20:04 +0000 (15:20 +1000)
If PERL_UNICODE was set to a value that modified stream behaviour, the
test added in 73f1eaca would fail, because the implied -C option would
cause the behaviour the test was checking wouldn't happen.

lib/open.t

index 586d8e2..2f2a04a 100644 (file)
@@ -195,21 +195,25 @@ SKIP: {
         "test for an endless loop in PerlIO_find_layer");
 }
 
-is runperl(
-     progs => [
-        'use open q\:encoding(UTF-8)\, q-:std-;',
-        'use open q\:encoding(UTF-8)\;',
-        'if(($_ = <STDIN>) eq qq-\x{100}\n-) { print qq-stdin ok\n- }',
-        'else { print qq-got -, join(q q q, map ord, split//), "\n" }',
-        'print STDOUT qq-\x{ff}\n-;',
-        'print STDERR qq-\x{ff}\n-;',
-     ],
-     stdin => "\xc4\x80\n",
-     stderr => 1,
-   ),
-   "stdin ok\n\xc3\xbf\n\xc3\xbf\n",
-   "use open without :std does not affect standard handles",
-;
+{
+    local $ENV{PERL_UNICODE};
+    delete $ENV{PERL_UNICODE};
+    is runperl(
+         progs => [
+            'use open q\:encoding(UTF-8)\, q-:std-;',
+            'use open q\:encoding(UTF-8)\;',
+            'if(($_ = <STDIN>) eq qq-\x{100}\n-) { print qq-stdin ok\n- }',
+            'else { print qq-got -, join(q q q, map ord, split//), "\n" }',
+            'print STDOUT qq-\x{ff}\n-;',
+            'print STDERR qq-\x{ff}\n-;',
+         ],
+         stdin => "\xc4\x80\n",
+         stderr => 1,
+       ),
+       "stdin ok\n\xc3\xbf\n\xc3\xbf\n",
+       "use open without :std does not affect standard handles",
+    ;
+}
 
 END {
     1 while unlink "utf8";