In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b7cc434062b30e0d0748be34d122883bd89711a7?hp=628253b8ba8b9cbebcf85ac3826fb6d8fdeb166a>
- Log ----------------------------------------------------------------- commit b7cc434062b30e0d0748be34d122883bd89711a7 Author: Karl Williamson <[email protected]> Date: Sun Jan 29 13:47:29 2012 -0700 lc.t: Add tests for previously broken IN_UNI_8_BIT This adds tests for commit b36bf33f6564c3e9a9ff131f4f3c9980b7a8af15 M t/op/lc.t commit ea4d335b445aa246c7b9e4d60a6983bb23108fc0 Author: Karl Williamson <[email protected]> Date: Sun Jan 29 10:41:14 2012 -0700 pp.c: Can grow scalar by less The max expansion when a Latin1 character is folded and converted to UTF-8 is '2' bytes per input byte, not the more general case. M pp.c ----------------------------------------------------------------------- Summary of changes: pp.c | 4 +++- t/op/lc.t | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pp.c b/pp.c index 1dc0460..29ed4c6 100644 --- a/pp.c +++ b/pp.c @@ -4218,7 +4218,9 @@ PP(pp_fc) SvCUR_set(dest, len); len = sv_utf8_upgrade_flags_grow(dest, SV_GMAGIC|SV_FORCE_UTF8_UPGRADE, - (send -s) * UTF8_MAX_FOLD_CHAR_EXPAND + 1); + /* The max expansion for latin1 + * chars is 1 byte becomes 2 */ + (send -s) * 2 + 1); d = (U8*)SvPVX(dest) + len; CAT_UNI_TO_UTF8_TWO_BYTE(d, GREEK_SMALL_LETTER_MU); diff --git a/t/op/lc.t b/t/op/lc.t index 08efdc0..5a71163 100644 --- a/t/op/lc.t +++ b/t/op/lc.t @@ -10,7 +10,7 @@ BEGIN { use feature qw( fc ); -plan tests => 124; +plan tests => 128; is(lc(undef), "", "lc(undef) is ''"); is(lcfirst(undef), "", "lcfirst(undef) is ''"); @@ -271,3 +271,12 @@ for ("$temp") { # new in Unicode 5.1.0 is(lc("\x{1E9E}"), "\x{df}", "lc(LATIN CAPITAL LETTER SHARP S)"); + +{ + use feature 'unicode_strings'; + use bytes; + is(lc("\xc0"), "\xc0", "lc of above-ASCII Latin1 is itself under use bytes"); + is(lcfirst("\xc0"), "\xc0", "lcfirst of above-ASCII Latin1 is itself under use bytes"); + is(uc("\xe0"), "\xe0", "uc of above-ASCII Latin1 is itself under use bytes"); + is(ucfirst("\xe0"), "\xe0", "ucfirst of above-ASCII Latin1 is itself under use bytes"); +} -- Perl5 Master Repository
