mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-24 21:54:01 -10:00
WASM enable System.Collections.NonGeneric.Tests (#39020)
This commit is contained in:
1 parent
9814beb66e
commit
2a4c626a0f
7 files changed
+37
-79
No files matched your search
@@ -183,8 +183,9 @@ namespace System
|
||||
public static Version ICUVersion => m_icuVersion.Value;
|
||||
|
||||
public static bool IsInvariantGlobalization => m_isInvariant.Value;
|
||||
public static bool IsNotInvariantGlobalization => !IsInvariantGlobalization;
|
||||
public static bool IsIcuGlobalization => ICUVersion > new Version(0,0,0,0);
|
||||
public static bool IsNlsGlobalization => !IsIcuGlobalization;
|
||||
public static bool IsNlsGlobalization => IsNotInvariantGlobalization && !IsIcuGlobalization;
|
||||
|
||||
private static Version GetICUVersion()
|
||||
{
|
||||
|
||||
@@ -45,14 +45,7 @@ namespace System.Collections.Tests
|
||||
[InlineData(null, null, 0)]
|
||||
public void Ctor_CultureInfo_Compare(object a, object b, int expected)
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
foreach (string cultureName in cultureNames)
|
||||
{
|
||||
@@ -74,14 +67,7 @@ namespace System.Collections.Tests
|
||||
[Fact]
|
||||
public void Ctor_CultureInfo_Compare_TurkishI()
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
foreach (string cultureName in cultureNames)
|
||||
{
|
||||
@@ -132,14 +118,7 @@ namespace System.Collections.Tests
|
||||
[InlineData(null, null, 0)]
|
||||
public void DefaultInvariant_Compare(object a, object b, int expected)
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
foreach (string cultureName in cultureNames)
|
||||
{
|
||||
|
||||
+4
-25
@@ -39,14 +39,7 @@ namespace System.Collections.Tests
|
||||
[InlineData(5, 10, false)]
|
||||
public void Ctor_Empty_ChangeCurrentCulture_GetHashCodeCompare(object a, object b, bool expected)
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
foreach (string cultureName in cultureNames)
|
||||
{
|
||||
@@ -80,14 +73,7 @@ namespace System.Collections.Tests
|
||||
[InlineData(5, 10, false)]
|
||||
public void Ctor_CultureInfo_ChangeCurrentCulture_GetHashCodeCompare(object a, object b, bool expected)
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
foreach (string cultureName in cultureNames)
|
||||
{
|
||||
@@ -111,14 +97,7 @@ namespace System.Collections.Tests
|
||||
[Fact]
|
||||
public void Ctor_CultureInfo_GetHashCodeCompare_TurkishI()
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
foreach (string cultureName in cultureNames)
|
||||
{
|
||||
@@ -170,7 +149,7 @@ namespace System.Collections.Tests
|
||||
CaseInsensitiveHashCodeProvider.DefaultInvariant.GetHashCode(a) == CaseInsensitiveHashCodeProvider.DefaultInvariant.GetHashCode(b));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
|
||||
public void Default_Compare_TurkishI()
|
||||
{
|
||||
// Turkish has lower-case and upper-case version of the dotted "i", so the upper case of "i" (U+0069) isn't "I" (U+0049)
|
||||
|
||||
@@ -39,14 +39,7 @@ namespace System.Collections.Tests
|
||||
[Fact]
|
||||
public void DefaultInvariant_Compare()
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
var string1 = new string[] { "Apple", "abc", };
|
||||
var string2 = new string[] { "\u00C6ble", "ABC" };
|
||||
@@ -67,8 +60,9 @@ namespace System.Collections.Tests
|
||||
using (new ThreadCultureChange(culture, culture))
|
||||
{
|
||||
Comparer comp = Comparer.DefaultInvariant;
|
||||
Assert.Equal(1, comp.Compare(string1[0], string2[0]));
|
||||
Assert.Equal(-1, comp.Compare(string1[1], string2[1]));
|
||||
/* Comparing in invariant mode compars firstChar - secondChar (A(65) - \u00C6(198) */
|
||||
Assert.Equal(PlatformDetection.IsInvariantGlobalization ? -1 : 1, Math.Sign(comp.Compare(string1[0], string2[0])));
|
||||
Assert.Equal(PlatformDetection.IsInvariantGlobalization ? 1 : -1, Math.Sign(comp.Compare(string1[1], string2[1])));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +80,17 @@ namespace System.Collections.Tests
|
||||
|
||||
public static IEnumerable<object[]> CompareTestData()
|
||||
{
|
||||
yield return new object[] { "hello", "hello", 0 };
|
||||
yield return new object[] { "HELLO", "HELLO", 0 };
|
||||
yield return new object[] { "hello", "HELLO", PlatformDetection.IsInvariantGlobalization ? 1 : -1 };
|
||||
yield return new object[] { "hello", "goodbye", 1 };
|
||||
yield return new object[] { 1, 2, -1 };
|
||||
yield return new object[] { 2, 1, 1 };
|
||||
yield return new object[] { 1, 1, 0 };
|
||||
yield return new object[] { 1, null, 1 };
|
||||
yield return new object[] { null, 1, -1 };
|
||||
yield return new object[] { null, null, 0 };
|
||||
|
||||
yield return new object[] { new Foo(5), new Bar(5), 0 };
|
||||
yield return new object[] { new Bar(5), new Foo(5), 0 };
|
||||
|
||||
@@ -94,16 +99,6 @@ namespace System.Collections.Tests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("hello", "hello", 0)]
|
||||
[InlineData("HELLO", "HELLO", 0)]
|
||||
[InlineData("hello", "HELLO", -1)]
|
||||
[InlineData("hello", "goodbye", 1)]
|
||||
[InlineData(1, 2, -1)]
|
||||
[InlineData(2, 1, 1)]
|
||||
[InlineData(1, 1, 0)]
|
||||
[InlineData(1, null, 1)]
|
||||
[InlineData(null, 1, -1)]
|
||||
[InlineData(null, null, 0)]
|
||||
[MemberData(nameof(CompareTestData))]
|
||||
public void Default_Compare(object a, object b, int expected)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,18 @@ namespace System.Collections.Tests
|
||||
{
|
||||
internal static class Helpers
|
||||
{
|
||||
public static string[] TestCultureNames =>
|
||||
PlatformDetection.IsInvariantGlobalization ?
|
||||
new string[] { "" } :
|
||||
new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
|
||||
public static void PerformActionOnAllHashtableWrappers(Hashtable hashtable, Action<Hashtable> action)
|
||||
{
|
||||
// Synchronized returns a slightly different version of Hashtable
|
||||
|
||||
@@ -1339,14 +1339,7 @@ namespace System.Collections.Tests
|
||||
|
||||
try
|
||||
{
|
||||
var cultureNames = new string[]
|
||||
{
|
||||
"cs-CZ","da-DK","de-DE","el-GR","en-US",
|
||||
"es-ES","fi-FI","fr-FR","hu-HU","it-IT",
|
||||
"ja-JP","ko-KR","nb-NO","nl-NL","pl-PL",
|
||||
"pt-BR","pt-PT","ru-RU","sv-SE","tr-TR",
|
||||
"zh-CN","zh-HK","zh-TW"
|
||||
};
|
||||
var cultureNames = Helpers.TestCultureNames;
|
||||
|
||||
var installedCultures = new CultureInfo[cultureNames.Length];
|
||||
var cultureDisplayNames = new string[installedCultures.Length];
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
<!-- Builds currently do not pass -->
|
||||
<ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.VisualBasic.Core\tests\Microsoft.VisualBasic.Core.Tests.csproj" />
|
||||
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.CodeDom\tests\System.CodeDom.Tests.csproj" />
|
||||
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Collections.NonGeneric\tests\System.Collections.NonGeneric.Tests.csproj" />
|
||||
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.ComponentModel.Annotations\tests\System.ComponentModel.Annotations.Tests.csproj" />
|
||||
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.ComponentModel.Primitives\tests\System.ComponentModel.Primitives.Tests.csproj" />
|
||||
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.ComponentModel.TypeConverter\tests\System.ComponentModel.TypeConverter.Tests.csproj" />
|
||||
|
||||
Reference in new issue
Block a user