summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-07-03 13:57:47 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-07-03 13:57:47 +0000
commit54f923ef6f478d1abc56049614d56e8a36625e1b (patch)
tree12295a01758cc6d63e1c8f5e96a17896d402ee2d /t
parent7bde033ebff0a0b90536713c20543166fab1b660 (diff)
downloadperl-54f923ef6f478d1abc56049614d56e8a36625e1b.tar.gz
Extra light testing for the UTF-8 cache
(that it isn't broken, not that it helps). p4raw-id: //depot/perl@19961
Diffstat (limited to 't')
-rw-r--r--t/op/length.t17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/op/length.t b/t/op/length.t
index d1cfda1da6..0c444840e5 100644
--- a/t/op/length.t
+++ b/t/op/length.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..15\n";
+print "1..20\n";
print "not " unless length("") == 0;
print "ok 1\n";
@@ -133,3 +133,18 @@ print "ok 3\n";
print "ok 15\n";
$test++;
}
+
+{
+ # Play around with Unicode strings,
+ # give a little workout to the UTF-8 length cache.
+ my $a = chr(256) x 100;
+ print length $a == 100 ? "ok 16\n" : "not ok 16\n";
+ chop $a;
+ print length $a == 99 ? "ok 17\n" : "not ok 17\n";
+ $a .= $a;
+ print length $a == 198 ? "ok 18\n" : "not ok 18\n";
+ $a = chr(256) x 999;
+ print length $a == 999 ? "ok 19\n" : "not ok 19\n";
+ substr($a, 0, 1) = '';
+ print length $a == 998 ? "ok 20\n" : "not ok 20\n";
+}