diff --git a/ext/PerlIO/encoding/t/nolooping.t b/ext/PerlIO/encoding/t/nolooping.t index c86cd0f240c4..f3436ad9e976 100644 --- a/ext/PerlIO/encoding/t/nolooping.t +++ b/ext/PerlIO/encoding/t/nolooping.t @@ -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"; # „ +if ($warn !~ /Cannot find encoding/) { + if (-e '/dev/null') { open STDERR, '>', '/dev/null' } + warn "# \x{201e}\n"; # „ +} ok(1); # we got that far