fix issue 11089 toUpper doesn't work with 1:m mappings

Also fixes a typo in generic toCase, adds test cases for
previously fixed issue 9629
This commit is contained in:
Dmitry Olshansky 2013-09-22 11:52:27 +04:00
parent 4db73ce83a
commit 256b62b370
2 changed files with 23 additions and 12 deletions

File diff suppressed because one or more lines are too long

View file

@ -6720,7 +6720,7 @@ private template toCaseLength(alias indexFn, uint maxIdx, alias tableFn)
ushort caseIndex = indexFn(ch);
if(caseIndex == ushort.max)
continue;
else if(caseIndex < MAX_SIMPLE_LOWER)
else if(caseIndex < maxIdx)
{
codeLen += startIdx - lastNonTrivial;
lastNonTrivial = curIdx;
@ -6858,8 +6858,19 @@ S toLower(S)(S s) @trusted pure
dchar low = ch.toLower();
assert(low == ch || isLower(low), format("%s -> %s", ch, low));
}
assert(toLower("АЯ") == "ая");
assert("\u1E9E".toLower == "\u00df");
assert("\u00df".toUpper == "SS");
}
//bugzilla 9629
unittest
{
wchar[] test = "hello þ world"w.dup;
auto piece = test[6..7];
toUpperInPlace(piece);
assert(test == "hello Þ world");
}