This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Skip this test if "use open" fails due to an unknown encoding
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 12 Feb 2007 17:00:09 +0000 (17:00 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Mon, 12 Feb 2007 17:00:09 +0000 (17:00 +0000)
p4raw-id: //depot/perl@30233

ext/PerlIO/encoding/t/nolooping.t

index c86cd0f..f3436ad 100644 (file)
@@ -2,9 +2,15 @@
 
 use Test::More tests => 1;
 
+BEGIN {
+    $SIG{__WARN__} = sub { $warn .= $_[0] };
+}
+
 # bug #41442
 use PerlIO::encoding;
 use open ':locale';
-if (-e '/dev/null') { open STDERR, '>', '/dev/null' }
-warn "# \x{201e}\n"; # &bdquo;
+if ($warn !~ /Cannot find encoding/) {
+    if (-e '/dev/null') { open STDERR, '>', '/dev/null' }
+    warn "# \x{201e}\n"; # &bdquo;
+}
 ok(1); # we got that far