From: Nicholas Clark Date: Tue, 11 Dec 2001 19:49:21 +0000 (+0000) Subject: Re: use utf8; with bad utf8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8ae6c9f99e092fdf00514ca2b50906e62538230b;p=p5sagit%2Fp5-mst-13.2.git Re: use utf8; with bad utf8 Message-ID: <20011211194921.R21702@plum.flirble.org> p4raw-id: //depot/perl@13628 --- diff --git a/lib/utf8.t b/lib/utf8.t index 850470e..15af665 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); +}