diff options
author | Nicholas Clark <nick@ccl4.org> | 2002-06-02 21:26:22 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-06-05 13:07:01 +0000 |
commit | bb7af5ca4c2c314cbc4d8bf6a2c966e012f3faa5 (patch) | |
tree | 52b9417b239580255e18ef3b75a8d6f13b333d7f /ext/PerlIO/t | |
parent | f1b028b3c03c8fa7693308c0e2b086525bc9ce34 (diff) | |
download | perl-bb7af5ca4c2c314cbc4d8bf6a2c966e012f3faa5.tar.gz |
[Encode PATCH] spurious warning
Message-ID: <20020602192619.GA320@Bagpuss.unfortu.net>
p4raw-id: //depot/perl@17009
Diffstat (limited to 'ext/PerlIO/t')
-rw-r--r-- | ext/PerlIO/t/encoding.t | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/ext/PerlIO/t/encoding.t b/ext/PerlIO/t/encoding.t index b53eab5f0d..986f21e6b1 100644 --- a/ext/PerlIO/t/encoding.t +++ b/ext/PerlIO/t/encoding.t @@ -1,8 +1,10 @@ -#!./perl +#!./perl -w BEGIN { chdir 't' if -d 't'; @INC = '../lib'; + no warnings; # Need global -w flag for later tests, but don't want this + # to warn here: push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS'; unless (find PerlIO::Layer 'perlio') { print "1..0 # Skip: not perlio\n"; @@ -10,11 +12,12 @@ BEGIN { } } -print "1..11\n"; +print "1..13\n"; my $grk = "grk$$"; my $utf = "utf$$"; my $fail1 = "fail$$"; +my $fail2 = "fail_$$"; my $russki = "koi8r$$"; if (open(GRK, ">$grk")) { @@ -68,7 +71,7 @@ if (open(GRK, "<$grk")) { close GRK; } -$SIG{__WARN__} = sub {$warn = $_[0]}; +$SIG{__WARN__} = sub {$warn .= $_[0]}; if (open(FAIL, ">:encoding(NoneSuch)", $fail1)) { print "not ok 9 # Open should fail\n"; @@ -90,7 +93,7 @@ if (open(RUSSKI, ">$russki")) { binmode(RUSSKI, ":raw"); my $buf1; read(RUSSKI, $buf1, 1); - eof(RUSSKI); + # eof(RUSSKI); binmode(RUSSKI, ":encoding(koi8-r)"); my $buf2; read(RUSSKI, $buf2, 1); @@ -109,6 +112,25 @@ if (open(RUSSKI, ">$russki")) { print "not ok 11 # open failed: $!\n"; } +undef $warn; + +# Check there is no Use of uninitialized value in concatenation (.) warning +# due to the way @latin2iso_num was used to make aliases. +if (open(FAIL, ">:encoding(latin42)", $fail2)) { + print "not ok 12 # Open should fail\n"; +} else { + print "ok 12\n"; +} +if (!defined $warn) { + print "not ok 13 # warning is undef\n"; +} elsif ($warn =~ /^Cannot find encoding "latin42" at.*line \d+\.$/) { + print "ok 13\n"; +} else { + print "not ok 13 # warning is: \n"; + $warn =~ s/^/# /mg; + print "$warn"; +} + END { unlink($grk, $utf, $fail1, $russki); } |