Skip to content

Commit 458b119

Browse files
tarekghCopilot
andauthored
Fix globalization test on mobile platforms (#115248)
* Fix globalization test on mobile platforms * Update src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoCtor.cs Co-authored-by: Copilot <[email protected]> * minor update * fix comment --------- Co-authored-by: Copilot <[email protected]>
1 parent 0654416 commit 458b119

File tree

1 file changed

+21
-4
lines changed
  • src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo

1 file changed

+21
-4
lines changed

src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoCtor.cs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,28 @@ public static IEnumerable<object[]> Ctor_String_TestData()
388388
}
389389
}
390390

391+
public static IEnumerable<object[]> Ctor_Undetermined_TestData()
392+
{
393+
yield return new object[] { "und-us", "und-US", "und-US" };
394+
yield return new object[] { "und-us_tradnl", "und-US", "und-US_tradnl"};
395+
396+
// On AppleMobile, the behavior of CultureInfo differs due to platform-specific
397+
// handling of Unicode extensions and subtags. These platforms preserve the full language tag, including
398+
// extensions, while other platforms normalize the tag to a simpler form.
399+
if (PlatformDetection.IsAppleMobile)
400+
{
401+
yield return new object[] { "und-es-u-co-phoneb", "und-ES-u-co-phoneb", "und-ES-u-co-phoneb" };
402+
yield return new object[] { "und-es-t-something", "und-ES-t-something", "und-ES-t-something" };
403+
}
404+
else
405+
{
406+
yield return new object[] { "und-es-u-co-phoneb", "und-ES", "und-ES_phoneb" };
407+
yield return new object[] { "und-es-t-something", "und-ES", "und-ES"};
408+
}
409+
}
410+
391411
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsIcuGlobalization))]
392-
[InlineData("und-us", "und-US", "und-US")]
393-
[InlineData("und-us_tradnl", "und-US", "und-US_tradnl")]
394-
[InlineData("und-es-u-co-phoneb", "und-ES", "und-ES_phoneb")]
395-
[InlineData("und-es-t-something", "und-ES", "und-ES")]
412+
[MemberData(nameof(Ctor_Undetermined_TestData))]
396413
public void CtorUndeterminedLanguageTag(string cultureName, string expectedCultureName, string expectedSortName)
397414
{
398415
CultureInfo culture = new CultureInfo(cultureName);

0 commit comments

Comments
 (0)