summaryrefslogtreecommitdiff
path: root/t/io
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-01-28 19:28:40 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-01-28 19:28:40 +0000
commitf9a6324217cffea75ff769ddd313748c0613a128 (patch)
tree9fb5b4ade5877ba969d093cfe37ec605de62d8dc /t/io
parent9ee2bb1a7c54b1866ff07ab9c157254810ee5205 (diff)
downloadperl-f9a6324217cffea75ff769ddd313748c0613a128.tar.gz
Patch from Inaba Hiroto:
- canonical UTF-8 hash keys: if a key string for a hash is UTF8-on, try downgrade the string and use it if unicode::distinct is not in effect. For the task, I added a function bytes_from_utf8() to utf8.c. It might resemble utf8_to_bytes() but it is not convenient to the task. Made a test for it and added to t/op/each.t - Changed do_print in doio.c to apply sv_utf8_(downgrade|upgrade) to the mortal copy of the argument SV. And changed t/io/utf8.t test 18 which expects print() to upgrade its argument. - re-implement sv_eq with bytes_from_utf8() - some bug fixes - tr/// does not handle UTF8 range (\x{}-\x{}) - \ before raw UTF8 character produced "Malformed UTF-8 character" warning. - "\x{100}\N{CENT SIGN}" is Malformed. Added tests for these 3. - and one silly bug (by me) with qu operator. p4raw-id: //depot/perl@8583
Diffstat (limited to 't/io')
-rwxr-xr-xt/io/utf8.t10
1 files changed, 5 insertions, 5 deletions
diff --git a/t/io/utf8.t b/t/io/utf8.t
index 04554e7797..d0201aaffb 100755
--- a/t/io/utf8.t
+++ b/t/io/utf8.t
@@ -91,17 +91,17 @@ print "not " unless $y == 1;
print "ok 17\n";
}
-print F $b,"\n"; # This upgrades $b!
+print F $b,"\n"; # Don't upgrades $b
{ # Check byte length of $b
use bytes; my $y = length($b);
-print "not " unless $y == 2;
+print "not ($y) " unless $y == 1;
print "ok 18\n";
}
{ my $x = tell(F);
{ use bytes; $y += 3;}
- print "not " unless $x == $y;
+ print "not ($x,$y) " unless $x == $y;
print "ok 19\n";
}
@@ -110,14 +110,14 @@ close F;
open F, "a" or die $!; # Not UTF
$x = <F>;
chomp($x);
-print "not " unless $x eq v196.172.194.130;
+printf "not (%vd) ", $x unless $x eq v196.172.194.130;
print "ok 20\n";
open F, "<:utf8", "a" or die $!;
$x = <F>;
chomp($x);
close F;
-print "not " unless $x eq chr(300).chr(130);
+printf "not (%vd) ", $x unless $x eq chr(300).chr(130);
print "ok 21\n";
# Now let's make it suffer.