diff options
author | Nicholas Clark <nick@ccl4.org> | 2001-12-11 19:49:21 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-12-11 19:13:57 +0000 |
commit | 8ae6c9f99e092fdf00514ca2b50906e62538230b (patch) | |
tree | 4334cc2155ebc9d39881862123ef6316e3c54f2b /lib/utf8.t | |
parent | 7b9cd8f0ea316b0a3cc47d9ba686a019be9b955c (diff) | |
download | perl-8ae6c9f99e092fdf00514ca2b50906e62538230b.tar.gz |
Re: use utf8; with bad utf8
Message-ID: <20011211194921.R21702@plum.flirble.org>
p4raw-id: //depot/perl@13628
Diffstat (limited to 'lib/utf8.t')
-rw-r--r-- | lib/utf8.t | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/utf8.t b/lib/utf8.t index 850470e0e8..15af665110 100644 --- a/lib/utf8.t +++ b/lib/utf8.t @@ -3,6 +3,7 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; + require './test.pl'; } # NOTE! @@ -27,8 +28,7 @@ BEGIN { # # -use Test; -plan tests => 15; +plan tests => 16; { # bug id 20001009.001 @@ -101,3 +101,20 @@ plan tests => 15; ok($w == 0 && $x eq "\x{100}"); } +{ + my $progfile = 'utf' . $$; + END {unlink $progfile} + open P, ">$progfile" or die "Can't open '$progfile': $!"; + # Interpolation of hex characters needs to take place now, as we're + # testing feeding malformed utf8 into perl. Bug now fixed was an + # "out of memory" error. We really need the "" [rather than qq() or q()] + # to get the best explosion. + print P <<"BANG"; + use utf8; %a = ("\xE1\xA0"=>"sterling"); + print 'start'; printf '%x,', ord $_ foreach keys %a; print "end\n"; +BANG + print "# Possible delay...\n"; + my $result = runperl ( verbose => 1, stderr => 1, progfile => $progfile ); + like ($result, + qr/^Malformed UTF-8 character \(2 bytes, need 3\).*start\d+,end$/s); +} |