Skip to content

Commit

Permalink
[mono] Update ICU version, disable some tests for Browser (dotnet#39596)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored and lewing committed Jul 21, 2020
1 parent d049aa7 commit 8f549f1
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 17 deletions.
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<Uri>https://github.com/dotnet/standard</Uri>
<Sha>cfe95a23647c7de1fe1a349343115bd7720d6949</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="5.0.0-preview.8.20365.1">
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="5.0.0-preview.8.20370.1">
<Uri>https://github.com/dotnet/icu</Uri>
<Sha>7247fa0d9e8faee2cceee6f04856b2c447f41bca</Sha>
<Sha>797c523dd8d75096319f3591958f703b8d74d04b</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<!-- ILLink -->
<MicrosoftNETILLinkTasksVersion>5.0.0-preview.3.20363.5</MicrosoftNETILLinkTasksVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>5.0.0-preview.8.20365.1</MicrosoftNETCoreRuntimeICUTransportVersion>
<MicrosoftNETCoreRuntimeICUTransportVersion>5.0.0-preview.8.20370.1</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- Mono LLVM -->
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>9.0.1-alpha.1.20356.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>9.0.1-alpha.1.20356.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,18 @@ public class CultureInfoEnglishName
public static IEnumerable<object[]> 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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,18 @@ public class CultureInfoNativeName
public static IEnumerable<object[]> 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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public static IEnumerable<object[]> 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() };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,51 @@ public void DisplayName(string name, string expected)
}
}

public static IEnumerable<object[]> 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<object[]> 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;
Expand Down

0 comments on commit 8f549f1

Please sign in to comment.