X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Flength.t;h=0c444840e57d202337ab1d68c30fdb25307bed9d;hb=e24631be6ac297b562086a055de17c5bd4247797;hp=d1cfda1da6cd16be2d1b51dae270230d8a86efec;hpb=e87322b2e8419defee882ceb696c003953500063;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/length.t b/t/op/length.t index d1cfda1..0c44484 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"; +}