Skip to content

Commit 302cc6f

Browse files
mdh1418Mitchell Hwang
andauthored
[libraries] Fix System.Runtime.Tests TimeZoneInfoTests for iOS/MacCatalyst/tvOS (#57732)
* [libraries] Fix System.Runtime.Tests TimeZoneInfoTests for iOS/MacCatalyst/tvOS * Remove redundant PlatformDetection.IsMacCatalyst as IsiOS covers it Co-authored-by: Mitchell Hwang <[email protected]>
1 parent f3b77e6 commit 302cc6f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static void Names()
8787
// Name abbreviations, if available, are used instead
8888
public static IEnumerable<object []> Platform_TimeZoneNamesTestData()
8989
{
90-
if (PlatformDetection.IsBrowser)
90+
if (PlatformDetection.IsBrowser || PlatformDetection.IsiOS || PlatformDetection.IstvOS)
9191
return new TheoryData<TimeZoneInfo, string, string, string>
9292
{
9393
{ TimeZoneInfo.FindSystemTimeZoneById(s_strPacific), "(UTC-08:00) America/Los_Angeles", "PST", "PDT" },
@@ -125,7 +125,6 @@ public static IEnumerable<object []> Platform_TimeZoneNamesTestData()
125125
// We test the existence of a specific English time zone name to avoid failures on non-English platforms.
126126
[ConditionalTheory(nameof(IsEnglishUILanguage))]
127127
[MemberData(nameof(Platform_TimeZoneNamesTestData))]
128-
[ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
129128
public static void Platform_TimeZoneNames(TimeZoneInfo tzi, string displayName, string standardName, string daylightName)
130129
{
131130
// Edge case - Optionally allow some characters to be absent in the display name.
@@ -2623,10 +2622,9 @@ public static void EnsureUtcObjectSingleton()
26232622
[InlineData("Argentina Standard Time", "America/Argentina/Catamarca")]
26242623
[InlineData("Newfoundland Standard Time", "America/St_Johns")]
26252624
[InlineData("Iran Standard Time", "Asia/Tehran")]
2626-
[ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
26272625
public static void UsingAlternativeTimeZoneIdsTest(string windowsId, string ianaId)
26282626
{
2629-
if (PlatformDetection.ICUVersion.Major >= 52)
2627+
if (PlatformDetection.ICUVersion.Major >= 52 && !PlatformDetection.IsiOS && !PlatformDetection.IstvOS)
26302628
{
26312629
TimeZoneInfo tzi1 = TimeZoneInfo.FindSystemTimeZoneById(ianaId);
26322630
TimeZoneInfo tzi2 = TimeZoneInfo.FindSystemTimeZoneById(windowsId);
@@ -2644,7 +2642,6 @@ public static void UsingAlternativeTimeZoneIdsTest(string windowsId, string iana
26442642
public static bool SupportIanaNamesConversion => PlatformDetection.IsNotBrowser && PlatformDetection.ICUVersion.Major >= 52;
26452643

26462644
[ConditionalFact(nameof(SupportIanaNamesConversion))]
2647-
[ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
26482645
public static void IsIanaIdTest()
26492646
{
26502647
bool expected = !s_isWindows;
@@ -2654,7 +2651,8 @@ public static void IsIanaIdTest()
26542651
Assert.True((expected || tzi.Id.Equals("Utc", StringComparison.OrdinalIgnoreCase)) == tzi.HasIanaId, $"`{tzi.Id}` has wrong IANA Id indicator");
26552652
}
26562653

2657-
Assert.False(TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time").HasIanaId, $"`Pacific Standard Time` should not be IANA Id.");
2654+
string timeZoneIdNotIANAId = PlatformDetection.IsiOS || PlatformDetection.IstvOS ? "America/Buenos_Aires" : "Pacific Standard Time";
2655+
Assert.False(TimeZoneInfo.FindSystemTimeZoneById(timeZoneIdNotIANAId).HasIanaId, $" should not be IANA Id.");
26582656
Assert.True(TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles").HasIanaId, $"'America/Los_Angeles' should be IANA Id");
26592657
}
26602658

@@ -2674,7 +2672,7 @@ public static void IsIanaIdTest()
26742672
[InlineData("Argentina Standard Time", "America/Buenos_Aires")]
26752673
[InlineData("Newfoundland Standard Time", "America/St_Johns")]
26762674
[InlineData("Iran Standard Time", "Asia/Tehran")]
2677-
[ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
2675+
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS/MacCatalyst/tvOS.")]
26782676
public static void IdsConversionsTest(string windowsId, string ianaId)
26792677
{
26802678
Assert.True(TimeZoneInfo.TryConvertIanaIdToWindowsId(ianaId, out string winId));
@@ -2709,7 +2707,7 @@ public static void IdsConversionsTest(string windowsId, string ianaId)
27092707
[InlineData("GMT Standard Time", "Europe/Dublin", "ie")]
27102708
[InlineData("W. Europe Standard Time", "Europe/Rome", "it")]
27112709
[InlineData("New Zealand Standard Time", "Pacific/Auckland", "nz")]
2712-
[ActiveIssue("https://github.com/dotnet/runtime/issues/52072", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
2710+
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on iOS/MacCatalyst/tvOS.")]
27132711
public static void IdsConversionsWithRegionTest(string windowsId, string ianaId, string region)
27142712
{
27152713
Assert.True(TimeZoneInfo.TryConvertWindowsIdToIanaId(windowsId, region, out string ianaConvertedId));

0 commit comments

Comments
 (0)