-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[browser][non-icu] HybridGlobalization
SortKey
#84621
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
715234e
Throw on SortKey.
ilonatommy dd19372
Fix NLS tests.
ilonatommy ea4a93e
Do not add these files for WASI.
ilonatommy 7dcbe65
Removed WASI from targets.
ilonatommy 020883a
Run tests with HG only on browser, rename.
ilonatommy c65d687
Missing WASI removal.
ilonatommy f46f9ac
Merge branch 'main' into hg-sortkey
ilonatommy 0056864
General docs fix.
ilonatommy 8eccd2e
Storing exception text as resource string.
ilonatommy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTestsBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Buffers; | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
using System.Reflection; | ||
using System.Text; | ||
using Xunit; | ||
|
||
namespace System.Globalization.Tests | ||
{ | ||
public class CompareInfoTestsBase | ||
{ | ||
// On Windows's NLS, hiragana characters sort after katakana. | ||
// On ICU, it is the opposite | ||
protected static int s_expectedHiraganaToKatakanaCompare = PlatformDetection.IsNlsGlobalization ? 1 : -1; | ||
|
||
// On Windows's NLS, all halfwidth characters sort before fullwidth characters. | ||
// On ICU, half and fullwidth characters that aren't in the "Halfwidth and fullwidth forms" block U+FF00-U+FFEF | ||
// sort before the corresponding characters that are in the block U+FF00-U+FFEF | ||
protected static int s_expectedHalfToFullFormsComparison = PlatformDetection.IsNlsGlobalization ? -1 : 1; | ||
|
||
protected static CompareInfo s_invariantCompare = CultureInfo.InvariantCulture.CompareInfo; | ||
protected static CompareInfo s_currentCompare = CultureInfo.CurrentCulture.CompareInfo; | ||
protected static CompareInfo s_germanCompare = new CultureInfo("de-DE").CompareInfo; | ||
protected static CompareInfo s_hungarianCompare = new CultureInfo("hu-HU").CompareInfo; | ||
protected static CompareInfo s_turkishCompare = new CultureInfo("tr-TR").CompareInfo; | ||
protected static CompareInfo s_japaneseCompare = new CultureInfo("ja-JP").CompareInfo; | ||
protected static CompareInfo s_slovakCompare = new CultureInfo("sk-SK").CompareInfo; | ||
protected static CompareOptions supportedIgnoreNonSpaceOption = | ||
PlatformDetection.IsHybridGlobalizationOnBrowser ? | ||
CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreKanaType : | ||
CompareOptions.IgnoreNonSpace; | ||
|
||
protected static CompareOptions supportedIgnoreCaseIgnoreNonSpaceOptions = | ||
PlatformDetection.IsHybridGlobalizationOnBrowser ? | ||
CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreKanaType : | ||
CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace; | ||
|
||
// There is a regression in Windows 190xx version with the Kana comparison. Avoid running this test there. | ||
protected static bool IsNotWindowsKanaRegressedVersion() => !PlatformDetection.IsWindows10Version1903OrGreater || | ||
PlatformDetection.IsIcuGlobalization || | ||
s_invariantCompare.Compare("\u3060", "\uFF80\uFF9E", CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth | CompareOptions.IgnoreCase) == 0; | ||
|
||
protected static bool IsNotWindowsKanaRegressedVersionAndNotHybridGlobalizationOnWasm() => !PlatformDetection.IsHybridGlobalizationOnBrowser && IsNotWindowsKanaRegressedVersion(); | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
src/libraries/System.Globalization/tests/Hybrid/Hybrid.WASM.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>$(NetCoreAppCurrent)-browser</TargetFramework> | ||
<TargetFrameworks>$(NetCoreAppCurrent)-browser</TargetFrameworks> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
<TestRuntime>true</TestRuntime> | ||
<HybridGlobalization>true</HybridGlobalization> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="..\System\Globalization\TextInfoTests.cs" /> | ||
<Compile Include="..\CompareInfo\CompareInfoTests.Compare.cs" /> | ||
<Compile Include="..\CompareInfo\CompareInfoTests.cs" /> | ||
<Compile Include="..\CompareInfo\CompareInfoTestsBase.cs" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in resource file and localized ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I can see all exception text in PrivateCoreLib are stored like this, so you are right.