Skip to content

Commit

Permalink
[release/5.0] Handle non-ASCII strings in GetNonRandomizedHashCodeOrd…
Browse files Browse the repository at this point in the history
…inalIgnoreCase (#45062)

* Backports #44681 fix to 5.0
* Backports #44695 fix to 5.0
  • Loading branch information
github-actions[bot] authored Nov 24, 2020
1 parent 90b8f7e commit d9a4a64
Show file tree
Hide file tree
Showing 4 changed files with 229 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,22 @@ public void CantAcceptDuplicateKeysFromSourceDictionary()
AssertExtensions.Throws<ArgumentException>(null, () => new Dictionary<string, int>(source, StringComparer.OrdinalIgnoreCase));
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
// https://github.com/dotnet/runtime/issues/44681
public void DictionaryOrdinalIgnoreCaseCyrillicKeys()
{
const string Lower = "абвгдеёжзийклмнопрстуфхцчшщьыъэюя";
const string Higher = "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ";

var dictionary = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);

for (int i = 0; i < Lower.Length; i++)
{
dictionary[Lower[i].ToString()] = i;
Assert.Equal(i, dictionary[Higher[i].ToString()]);
}
}

public static IEnumerable<object[]> CopyConstructorStringComparerData
{
get
Expand Down
Loading

0 comments on commit d9a4a64

Please sign in to comment.