mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
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:
parent
4db73ce83a
commit
256b62b370
2 changed files with 23 additions and 12 deletions
File diff suppressed because one or more lines are too long
15
std/uni.d
15
std/uni.d
|
@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue