From 8f549f1f838977de6e3070f85cdddf3de109c007 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Mon, 20 Jul 2020 21:38:01 +0300 Subject: [PATCH] [mono] Update ICU version, disable some tests for Browser (#39596) --- eng/Version.Details.xml | 4 +- eng/Versions.props | 2 +- .../CultureInfo/CultureInfoEnglishName.cs | 14 +++++- .../CultureInfo/CultureInfoNativeName.cs | 14 +++++- .../DateTimeFormatInfoTests.cs | 7 ++- .../NumberFormatInfoNumberGroupSizes.cs | 4 +- .../System/Globalization/RegionInfoTests.cs | 45 ++++++++++++++++--- 7 files changed, 73 insertions(+), 17 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 098240ee26cbd..0d7aad96f5897 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -4,9 +4,9 @@ https://github.com/dotnet/standard cfe95a23647c7de1fe1a349343115bd7720d6949 - + https://github.com/dotnet/icu - 7247fa0d9e8faee2cceee6f04856b2c447f41bca + 797c523dd8d75096319f3591958f703b8d74d04b diff --git a/eng/Versions.props b/eng/Versions.props index fb7f7da035076..d578146bafbea 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -118,7 +118,7 @@ 5.0.0-preview.3.20363.5 - 5.0.0-preview.8.20365.1 + 5.0.0-preview.8.20370.1 9.0.1-alpha.1.20356.1 9.0.1-alpha.1.20356.1 diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoEnglishName.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoEnglishName.cs index 23c2032c51cd4..fdb6e4b189fce 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoEnglishName.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoEnglishName.cs @@ -11,8 +11,18 @@ public class CultureInfoEnglishName public static IEnumerable EnglishName_TestData() { yield return new object[] { CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.EnglishName }; - yield return new object[] { "en-US", "English (United States)" }; - yield return new object[] { "fr-FR", "French (France)" }; + + if (PlatformDetection.IsNotBrowser) + { + yield return new object[] { "en-US", "English (United States)" }; + yield return new object[] { "fr-FR", "French (France)" }; + } + else + { + // Browser's ICU doesn't contain CultureInfo.EnglishName + yield return new object[] { "en-US", "en (US)" }; + yield return new object[] { "fr-FR", "fr (FR)" }; + } } [Theory] diff --git a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoNativeName.cs b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoNativeName.cs index b97a645b8b2a5..58429b132138c 100644 --- a/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoNativeName.cs +++ b/src/libraries/System.Globalization/tests/CultureInfo/CultureInfoNativeName.cs @@ -11,8 +11,18 @@ public class CultureInfoNativeName public static IEnumerable NativeName_TestData() { yield return new object[] { CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.NativeName }; - yield return new object[] { "en-US", "English (United States)" }; - yield return new object[] { "en-CA", "English (Canada)" }; + + if (PlatformDetection.IsNotBrowser) + { + yield return new object[] { "en-US", "English (United States)" }; + yield return new object[] { "en-CA", "English (Canada)" }; + } + else + { + // Browser's ICU doesn't contain CultureInfo.NativeName + yield return new object[] { "en-US", "en (US)" }; + yield return new object[] { "en-CA", "en (CA)" }; + } } [Theory] diff --git a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs index 1689c9e312d2d..52cda26a787ae 100644 --- a/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs +++ b/src/libraries/System.Globalization/tests/DateTimeFormatInfo/DateTimeFormatInfoTests.cs @@ -66,7 +66,12 @@ public void NativeCalendarName_Get_ReturnsExpected(DateTimeFormatInfo dtfi, Cale try { dtfi.Calendar = calendar; - Assert.Equal(nativeCalendarName, dtfi.NativeCalendarName); + + if (PlatformDetection.IsNotBrowser) + { + // Browser's ICU doesn't contain NativeCalendarName, + Assert.Equal(nativeCalendarName, dtfi.NativeCalendarName); + } } catch { diff --git a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs index 045d3e0b585be..62ae02d3aa4a4 100644 --- a/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs +++ b/src/libraries/System.Globalization/tests/NumberFormatInfo/NumberFormatInfoNumberGroupSizes.cs @@ -13,8 +13,8 @@ public static IEnumerable NumberGroupSizes_TestData() yield return new object[] { NumberFormatInfo.InvariantInfo, new int[] { 3 } }; yield return new object[] { CultureInfo.GetCultureInfo("en-US").NumberFormat, new int[] { 3 } }; - // Culture does not exist on Windows 7 - if (!PlatformDetection.IsWindows7) + // Culture does not exist on Windows 7 and in Browser's ICU + if (!PlatformDetection.IsWindows7 && PlatformDetection.IsNotBrowser) { yield return new object[] { CultureInfo.GetCultureInfo("ur-IN").NumberFormat, NumberFormatInfoData.UrINNumberGroupSizes() }; } diff --git a/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs b/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs index dd99a40e94ca8..2cb86dc56da24 100644 --- a/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs +++ b/src/libraries/System.Globalization/tests/System/Globalization/RegionInfoTests.cs @@ -90,20 +90,51 @@ public void DisplayName(string name, string expected) } } + public static IEnumerable NativeName_TestData() + { + if (PlatformDetection.IsNotBrowser) + { + yield return new object[] { "GB", "United Kingdom" }; + yield return new object[] { "SE", "Sverige" }; + yield return new object[] { "FR", "France" }; + } + else + { + // Browser's ICU doesn't contain RegionInfo.NativeName + yield return new object[] { "GB", "GB" }; + yield return new object[] { "SE", "SE" }; + yield return new object[] { "FR", "FR" }; + } + } + [Theory] - [InlineData("GB", "United Kingdom")] - [InlineData("SE", "Sverige")] - [InlineData("FR", "France")] + [MemberData(nameof(NativeName_TestData))] public void NativeName(string name, string expected) { Assert.Equal(expected, new RegionInfo(name).NativeName); } + public static IEnumerable EnglishName_TestData() + { + if (PlatformDetection.IsNotBrowser) + { + yield return new object[] { "en-US", new string[] { "United States" } }; + yield return new object[] { "US", new string[] { "United States" } }; + yield return new object[] { "zh-CN", new string[] { "China", "People's Republic of China", "China mainland" }}; + yield return new object[] { "CN", new string[] { "China", "People's Republic of China", "China mainland" } }; + } + else + { + // Browser's ICU doesn't contain RegionInfo.EnglishName + yield return new object[] { "en-US", new string[] { "US" } }; + yield return new object[] { "US", new string[] { "US" } }; + yield return new object[] { "zh-CN", new string[] { "CN" }}; + yield return new object[] { "CN", new string[] { "CN" } }; + } + } + [Theory] - [InlineData("en-US", new string[] { "United States" })] - [InlineData("US", new string[] { "United States" })] - [InlineData("zh-CN", new string[] { "China", "People's Republic of China", "China mainland" })] - [InlineData("CN", new string[] { "China", "People's Republic of China", "China mainland" })] + [MemberData(nameof(EnglishName_TestData))] public void EnglishName(string name, string[] expected) { string result = new RegionInfo(name).EnglishName;