From 5bff34a3762724b35c4d6ef81e804159ba1b789e Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:35:45 +0000 Subject: [PATCH 1/4] Remove invaraint cace change from JS and rely on methods used in InvariantGlobalization. --- .../src/Interop/Browser/Interop.TextInfo.cs | 2 - .../Common/tests/Tests/System/StringTests.cs | 2 - .../Globalization/TextInfo.WebAssembly.cs | 5 +- .../src/System/Globalization/TextInfo.cs | 30 ++++++++++- .../System/StringTests.cs | 1 - .../FunctionalTests/RegexCultureTests.cs | 1 - src/mono/browser/runtime/corebindings.c | 2 - .../browser/runtime/globalization-stubs.ts | 8 --- src/mono/browser/runtime/globalization.ts | 3 +- .../hybrid-globalization/change-case.ts | 54 ------------------- .../hybrid-globalization/module-exports.ts | 3 +- src/mono/browser/runtime/types/internal.ts | 1 - 12 files changed, 33 insertions(+), 79 deletions(-) diff --git a/src/libraries/Common/src/Interop/Browser/Interop.TextInfo.cs b/src/libraries/Common/src/Interop/Browser/Interop.TextInfo.cs index a10d2897f75be..c9a0b3ac39fb4 100644 --- a/src/libraries/Common/src/Interop/Browser/Interop.TextInfo.cs +++ b/src/libraries/Common/src/Interop/Browser/Interop.TextInfo.cs @@ -7,8 +7,6 @@ internal static partial class Interop { internal static unsafe partial class JsGlobalization { - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern unsafe nint ChangeCaseInvariant(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper); [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern unsafe nint ChangeCase(char* culture, int cultureLen, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper); } diff --git a/src/libraries/Common/tests/Tests/System/StringTests.cs b/src/libraries/Common/tests/Tests/System/StringTests.cs index 8e465475a5200..709d7c9847403 100644 --- a/src/libraries/Common/tests/Tests/System/StringTests.cs +++ b/src/libraries/Common/tests/Tests/System/StringTests.cs @@ -1287,7 +1287,6 @@ public static void ContainsMatchDifferentSpans_StringComparison() [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnApplePlatform))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95471", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))] public static void ContainsNoMatch_StringComparison() { for (int length = 1; length < 150; length++) @@ -6041,7 +6040,6 @@ public static IEnumerable ToUpper_TurkishI_InvariantCulture_MemberData [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization), nameof(PlatformDetection.IsNotHybridGlobalizationOnApplePlatform))] [MemberData(nameof(ToUpper_TurkishI_InvariantCulture_MemberData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95471", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))] public static void ToUpper_TurkishI_InvariantCulture(string s, string expected) { using (new ThreadCultureChange(CultureInfo.InvariantCulture)) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs index 05e8cc3e1d049..083a3b0423d21 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs @@ -11,15 +11,14 @@ public partial class TextInfo internal unsafe void JsChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool toUpper) { Debug.Assert(!GlobalizationMode.Invariant); + Debug.Assert(!HasEmptyCultureName); Debug.Assert(!GlobalizationMode.UseNls); Debug.Assert(GlobalizationMode.Hybrid); ReadOnlySpan cultureName = _cultureName.AsSpan(); fixed (char* pCultureName = &MemoryMarshal.GetReference(cultureName)) { - nint exceptionPtr = HasEmptyCultureName ? - Interop.JsGlobalization.ChangeCaseInvariant(src, srcLen, dstBuffer, dstBufferCapacity, toUpper) : - Interop.JsGlobalization.ChangeCase(pCultureName, cultureName.Length, src, srcLen, dstBuffer, dstBufferCapacity, toUpper); + nint exceptionPtr = Interop.JsGlobalization.ChangeCase(pCultureName, cultureName.Length, src, srcLen, dstBuffer, dstBufferCapacity, toUpper); Helper.MarshalAndThrowIfException(exceptionPtr); } } diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs index a035c875f7290..45123f85d4341 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.cs @@ -140,7 +140,12 @@ public string ListSeparator /// public char ToLower(char c) { +#if TARGET_BROWSER + // for invariant culture _cultureName is empty - HybridGlobalization does not have to call JS + if (GlobalizationMode.Invariant || (GlobalizationMode.Hybrid && HasEmptyCultureName)) +#else if (GlobalizationMode.Invariant) +#endif { return InvariantModeCasing.ToLower(c); } @@ -173,7 +178,12 @@ public string ToLower(string str) { ArgumentNullException.ThrowIfNull(str); +#if TARGET_BROWSER + // for invariant culture _cultureName is empty - HybridGlobalization does not have to call JS + if (GlobalizationMode.Invariant || (GlobalizationMode.Hybrid && HasEmptyCultureName)) +#else if (GlobalizationMode.Invariant) +#endif { return InvariantModeCasing.ToLower(str); } @@ -184,7 +194,9 @@ public string ToLower(string str) private unsafe char ChangeCase(char c, bool toUpper) { Debug.Assert(!GlobalizationMode.Invariant); - +#if TARGET_BROWSER + Debug.Assert(!(GlobalizationMode.Hybrid && HasEmptyCultureName)); +#endif char dst = default; ChangeCaseCore(&c, 1, &dst, 1, toUpper); return dst; @@ -227,6 +239,9 @@ private unsafe void ChangeCaseCommon(ReadOnlySpan source, Spa { Debug.Assert(!GlobalizationMode.Invariant); Debug.Assert(typeof(TConversion) == typeof(ToUpperConversion) || typeof(TConversion) == typeof(ToLowerConversion)); +#if TARGET_BROWSER + Debug.Assert(!(GlobalizationMode.Hybrid && HasEmptyCultureName)); +#endif if (source.IsEmpty) { @@ -263,6 +278,9 @@ private unsafe string ChangeCaseCommon(string source) where TConver Debug.Assert(!GlobalizationMode.Invariant); Debug.Assert(source != null); +#if TARGET_BROWSER + Debug.Assert(!(GlobalizationMode.Hybrid && HasEmptyCultureName)); +#endif // If the string is empty, we're done. if (source.Length == 0) @@ -412,7 +430,12 @@ private static char ToLowerAsciiInvariant(char c) /// public char ToUpper(char c) { +#if TARGET_BROWSER + // for invariant culture _cultureName is empty - HybridGlobalization does not have to call JS + if (GlobalizationMode.Invariant || (GlobalizationMode.Hybrid && HasEmptyCultureName)) +#else if (GlobalizationMode.Invariant) +#endif { return InvariantModeCasing.ToUpper(c); } @@ -445,7 +468,12 @@ public string ToUpper(string str) { ArgumentNullException.ThrowIfNull(str); +#if TARGET_BROWSER + // for invariant culture _cultureName is empty - HybridGlobalization does not have to call JS + if (GlobalizationMode.Invariant || (GlobalizationMode.Hybrid && HasEmptyCultureName)) +#else if (GlobalizationMode.Invariant) +#endif { return InvariantModeCasing.ToUpper(str); } diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs index f6885ffc650f7..5ec5de1931d91 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/StringTests.cs @@ -871,7 +871,6 @@ public static IEnumerable Replace_StringComparisonCulture_TestData() [Theory] [MemberData(nameof(Replace_StringComparisonCulture_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95471", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))] [ActiveIssue("https://github.com/dotnet/runtime/issues/95503", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))] public void Replace_StringComparisonCulture_ReturnsExpected(string original, string oldValue, string newValue, bool ignoreCase, CultureInfo culture, string expected) { diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCultureTests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCultureTests.cs index eb40521b07b5e..bfc4f4dc1cdaa 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCultureTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCultureTests.cs @@ -161,7 +161,6 @@ Regex[] Create(string input, CultureInfo info, RegexOptions additional) [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Doesn't support NonBacktracking")] [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/95471", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))] [ActiveIssue("https://github.com/dotnet/runtime/issues/60568", TestPlatforms.Android | TestPlatforms.LinuxBionic)] public async Task TurkishI_Is_Differently_LowerUpperCased_In_Turkish_Culture_NonBacktracking() { diff --git a/src/mono/browser/runtime/corebindings.c b/src/mono/browser/runtime/corebindings.c index 1937eb114dd6d..15a185133ce36 100644 --- a/src/mono/browser/runtime/corebindings.c +++ b/src/mono/browser/runtime/corebindings.c @@ -59,7 +59,6 @@ extern void mono_wasm_invoke_jsimport_ST (int function_handle, void *args); #endif /* DISABLE_THREADS */ // HybridGlobalization -extern char16_t* mono_wasm_change_case_invariant (const uint16_t* src, int32_t srcLength, uint16_t* dst, int32_t dstLength, mono_bool bToUpper); extern char16_t* mono_wasm_change_case (const uint16_t* culture, int32_t cultureLength, const uint16_t* src, int32_t srcLength, uint16_t* dst, int32_t dstLength, mono_bool bToUpper); extern char16_t* mono_wasm_compare_string (const uint16_t* culture, int32_t cultureLength, const uint16_t* str1, int32_t str1Length, const uint16_t* str2, int32_t str2Length, int32_t options, int *resultPtr); extern char16_t* mono_wasm_starts_with (const uint16_t* culture, int32_t cultureLength, const uint16_t* str1, int32_t str1Length, const uint16_t* str2, int32_t str2Length, int32_t options, mono_bool *resultPtr); @@ -104,7 +103,6 @@ void bindings_initialize_internals (void) mono_add_internal_call ("System.ConsolePal::Clear", mono_wasm_console_clear); // HybridGlobalization - mono_add_internal_call ("Interop/JsGlobalization::ChangeCaseInvariant", mono_wasm_change_case_invariant); mono_add_internal_call ("Interop/JsGlobalization::ChangeCase", mono_wasm_change_case); mono_add_internal_call ("Interop/JsGlobalization::CompareString", mono_wasm_compare_string); mono_add_internal_call ("Interop/JsGlobalization::StartsWith", mono_wasm_starts_with); diff --git a/src/mono/browser/runtime/globalization-stubs.ts b/src/mono/browser/runtime/globalization-stubs.ts index 5544c3123d2b3..a1a42dc1cd414 100644 --- a/src/mono/browser/runtime/globalization-stubs.ts +++ b/src/mono/browser/runtime/globalization-stubs.ts @@ -5,14 +5,6 @@ import { globalizationHelpers } from "./globals"; import { Int32Ptr, VoidPtr } from "./types/emscripten"; import { VoidPtrNull } from "./types/internal"; - -export function mono_wasm_change_case_invariant (src: number, srcLength: number, dst: number, dstLength: number, toUpper: number) : VoidPtr { - if (typeof globalizationHelpers.mono_wasm_change_case_invariant === "function") { - return globalizationHelpers.mono_wasm_change_case_invariant(src, srcLength, dst, dstLength, toUpper); - } - return VoidPtrNull; -} - export function mono_wasm_change_case (culture: number, cultureLength: number, src: number, srcLength: number, dst: number, dstLength: number, toUpper: number) : VoidPtr { if (typeof globalizationHelpers.mono_wasm_change_case === "function") { return globalizationHelpers.mono_wasm_change_case(culture, cultureLength, src, srcLength, dst, dstLength, toUpper); diff --git a/src/mono/browser/runtime/globalization.ts b/src/mono/browser/runtime/globalization.ts index 95fac11927335..fe1b95be3ba73 100644 --- a/src/mono/browser/runtime/globalization.ts +++ b/src/mono/browser/runtime/globalization.ts @@ -1,11 +1,10 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -import { mono_wasm_change_case, mono_wasm_change_case_invariant, mono_wasm_compare_string, mono_wasm_ends_with, mono_wasm_get_calendar_info, mono_wasm_get_culture_info, mono_wasm_get_first_day_of_week, mono_wasm_get_first_week_of_year, mono_wasm_index_of, mono_wasm_starts_with } from "./globalization-stubs"; +import { mono_wasm_change_case, mono_wasm_compare_string, mono_wasm_ends_with, mono_wasm_get_calendar_info, mono_wasm_get_culture_info, mono_wasm_get_first_day_of_week, mono_wasm_get_first_week_of_year, mono_wasm_index_of, mono_wasm_starts_with } from "./globalization-stubs"; import { mono_wasm_get_locale_info } from "./locales-common"; export const mono_wasm_hybrid_globalization_imports = [ - mono_wasm_change_case_invariant, mono_wasm_change_case, mono_wasm_compare_string, mono_wasm_starts_with, diff --git a/src/mono/browser/runtime/hybrid-globalization/change-case.ts b/src/mono/browser/runtime/hybrid-globalization/change-case.ts index c5b1a425ac0fd..0024b5b45d5d1 100644 --- a/src/mono/browser/runtime/hybrid-globalization/change-case.ts +++ b/src/mono/browser/runtime/hybrid-globalization/change-case.ts @@ -6,60 +6,6 @@ import { runtimeHelpers } from "./module-exports"; import { VoidPtr } from "../types/emscripten"; import { isSurrogate } from "./helpers"; -export function mono_wasm_change_case_invariant (src: number, srcLength: number, dst: number, dstLength: number, toUpper: number): VoidPtr { - try { - const input = runtimeHelpers.utf16ToStringLoop(src, src + 2 * srcLength); - const result = toUpper ? input.toUpperCase() : input.toLowerCase(); - // Unicode defines some codepoints which expand into multiple codepoints, - // originally we do not support this expansion - if (result.length <= dstLength) { - runtimeHelpers.stringToUTF16(dst, dst + 2 * dstLength, result); - return VoidPtrNull; - } - - // workaround to maintain the ICU-like behavior - const heapI16 = runtimeHelpers.localHeapViewU16(); - let jump = 1; - if (toUpper) { - for (let i = 0; i < input.length; i += jump) { - // surrogate parts have to enter ToUpper/ToLower together to give correct output - if (isSurrogate(input, i)) { - jump = 2; - const surrogate = input.substring(i, i + 2); - const upperSurrogate = surrogate.toUpperCase(); - const appendedSurrogate = upperSurrogate.length > 2 ? surrogate : upperSurrogate; - appendSurrogateToMemory(heapI16, dst, appendedSurrogate, i); - - } else { - jump = 1; - const upperChar = input[i].toUpperCase(); - const appendedChar = upperChar.length > 1 ? input[i] : upperChar; - runtimeHelpers.setU16_local(heapI16, dst + i * 2, appendedChar.charCodeAt(0)); - } - } - } else { - for (let i = 0; i < input.length; i += jump) { - if (isSurrogate(input, i)) { - jump = 2; - const surrogate = input.substring(i, i + 2); - const upperSurrogate = surrogate.toLowerCase(); - const appendedSurrogate = upperSurrogate.length > 2 ? surrogate : upperSurrogate; - appendSurrogateToMemory(heapI16, dst, appendedSurrogate, i); - - } else { - jump = 1; - const upperChar = input[i].toLowerCase(); - const appendedChar = upperChar.length > 1 ? input[i] : upperChar; - runtimeHelpers.setU16_local(heapI16, dst + i * 2, appendedChar.charCodeAt(0)); - } - } - } - return VoidPtrNull; - } catch (ex: any) { - return runtimeHelpers.stringToUTF16Ptr(ex.toString()); - } -} - export function mono_wasm_change_case (culture: number, cultureLength: number, src: number, srcLength: number, dst: number, dstLength: number, toUpper: number): VoidPtr { try { const cultureName = runtimeHelpers.utf16ToString(culture, (culture + 2 * cultureLength)); diff --git a/src/mono/browser/runtime/hybrid-globalization/module-exports.ts b/src/mono/browser/runtime/hybrid-globalization/module-exports.ts index dc5b3aebf8fd4..f17bf90d4f245 100644 --- a/src/mono/browser/runtime/hybrid-globalization/module-exports.ts +++ b/src/mono/browser/runtime/hybrid-globalization/module-exports.ts @@ -1,6 +1,6 @@ import { GlobalizationHelpers, RuntimeHelpers } from "../types/internal"; import { mono_wasm_get_calendar_info } from "./calendar"; -import { mono_wasm_change_case, mono_wasm_change_case_invariant } from "./change-case"; +import { mono_wasm_change_case } from "./change-case"; import { mono_wasm_compare_string, mono_wasm_starts_with, mono_wasm_ends_with, mono_wasm_index_of } from "./collations"; import { mono_wasm_get_culture_info } from "./culture-info"; import { setSegmentationRulesFromJson } from "./grapheme-segmenter"; @@ -10,7 +10,6 @@ export let globalizationHelpers: GlobalizationHelpers; export let runtimeHelpers: RuntimeHelpers; export function initHybrid (gh: GlobalizationHelpers, rh: RuntimeHelpers) { - gh.mono_wasm_change_case_invariant = mono_wasm_change_case_invariant; gh.mono_wasm_change_case = mono_wasm_change_case; gh.mono_wasm_compare_string = mono_wasm_compare_string; gh.mono_wasm_starts_with = mono_wasm_starts_with; diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts index 827c9787af27c..6f1977c69ac30 100644 --- a/src/mono/browser/runtime/types/internal.ts +++ b/src/mono/browser/runtime/types/internal.ts @@ -253,7 +253,6 @@ export type RuntimeHelpers = { } export type GlobalizationHelpers = { - mono_wasm_change_case_invariant: (src: number, srcLength: number, dst: number, dstLength: number, toUpper: number) => VoidPtr; mono_wasm_change_case: (culture: number, cultureLength: number, src: number, srcLength: number, dst: number, dstLength: number, toUpper: number) => VoidPtr; mono_wasm_compare_string: (culture: number, cultureLength: number, str1: number, str1Length: number, str2: number, str2Length: number, options: number, resultPtr: Int32Ptr) => VoidPtr; mono_wasm_starts_with: (culture: number, cultureLength: number, str1: number, str1Length: number, str2: number, str2Length: number, options: number, resultPtr: Int32Ptr) => VoidPtr; From facac9b78761a35e7bc674a9d10dea85c53067c0 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 4 Jun 2024 15:52:14 +0000 Subject: [PATCH 2/4] Fix - some internal libs are using `ChangeCaseCore` with invariant culture. --- .../System/Globalization/TextInfo.WebAssembly.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs index 083a3b0423d21..459478f705504 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/TextInfo.WebAssembly.cs @@ -11,10 +11,24 @@ public partial class TextInfo internal unsafe void JsChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool toUpper) { Debug.Assert(!GlobalizationMode.Invariant); - Debug.Assert(!HasEmptyCultureName); Debug.Assert(!GlobalizationMode.UseNls); Debug.Assert(GlobalizationMode.Hybrid); + if (HasEmptyCultureName) + { + ReadOnlySpan source = new ReadOnlySpan(src, srcLen); + Span destination = new Span(dstBuffer, dstBufferCapacity); + if (toUpper) + { + InvariantModeCasing.ToUpper(source, destination); + } + else + { + InvariantModeCasing.ToLower(source, destination); + } + return; + } + ReadOnlySpan cultureName = _cultureName.AsSpan(); fixed (char* pCultureName = &MemoryMarshal.GetReference(cultureName)) { From 7ee001c8521f744c9ef66f11ab9a555707cd7a6e Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 6 Jun 2024 07:37:08 +0000 Subject: [PATCH 3/4] Fix NodeJS failures - it behaves like old chrome. --- .../DateTimeFormatInfoAMDesignator.cs | 4 ++-- ...ateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs | 4 ++-- .../DateTimeFormatInfoAbbreviatedMonthNames.cs | 2 +- .../DateTimeFormatInfoFullDateTimePattern.cs | 12 ++++++------ .../DateTimeFormatInfoGetAbbreviatedEraName.cs | 2 +- .../DateTimeFormatInfoGetEraName.cs | 4 ++-- .../DateTimeFormatInfoLongDatePattern.cs | 8 ++++---- .../DateTimeFormatInfoLongTimePattern.cs | 4 ++-- .../DateTimeFormatInfoMonthGenitiveNames.cs | 2 +- .../DateTimeFormatInfoMonthNames.cs | 2 +- .../DateTimeFormatInfoPMDesignator.cs | 4 ++-- .../DateTimeFormatInfoShortDatePattern.cs | 6 +++--- .../DateTimeFormatInfoShortTimePattern.cs | 2 +- .../DateTimeFormatInfoShortestDayNames.cs | 2 +- .../DateTimeFormatInfoYearMonthPattern.cs | 2 +- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAMDesignator.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAMDesignator.cs index 3bc6ad88fb349..b7e33c11af97f 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAMDesignator.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAMDesignator.cs @@ -137,7 +137,7 @@ public static IEnumerable AMDesignator_Get_TestData_HybridGlobalizatio yield return new object[] { "en-ZA", "am" }; yield return new object[] { "en-ZM", "am" }; yield return new object[] { "en-ZW", "am" }; - string latinAmericaSpanishAMDesignator = PlatformDetection.IsFirefox ? "a.\u00A0m." : "a.m."; + string latinAmericaSpanishAMDesignator = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "a.\u00A0m." : "a.m."; yield return new object[] { "es-419", latinAmericaSpanishAMDesignator }; yield return new object[] { "es-ES", "a.\u00A0m." }; yield return new object[] { "es-MX", latinAmericaSpanishAMDesignator }; @@ -189,7 +189,7 @@ public static IEnumerable AMDesignator_Get_TestData_HybridGlobalizatio yield return new object[] { "sw-KE", "AM" }; yield return new object[] { "sw-TZ", "AM" }; yield return new object[] { "sw-UG", "AM" }; - string tamilAMDesignator = PlatformDetection.IsFirefox ? "முற்பகல்" : "AM"; // முற்பகல் + string tamilAMDesignator = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "முற்பகல்" : "AM"; // முற்பகல் yield return new object[] { "ta-IN", tamilAMDesignator }; yield return new object[] { "ta-LK", tamilAMDesignator }; yield return new object[] { "ta-MY", tamilAMDesignator }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs index e7a66fa2f83a0..93b46e757e292 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs @@ -12,7 +12,7 @@ public static IEnumerable AbbreviatedMonthGenitiveNames_Get_TestData_H { // see the comments on the right to check the non-Hybrid result, if it differs yield return new object[] { "ar-SA", new string[] { "محرم", "صفر", "ربيع الأول", "ربيع الآخر", "جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدة", "ذو الحجة", "" } }; - if (PlatformDetection.IsFirefox) + if (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) { yield return new object[] { "am-ET", new string[] { "ጃንዩ", "ፌብሩ", "ማርች", "ኤፕሪ", "ሜይ", "ጁን", "ጁላይ", "ኦገስ", "ሴፕቴ", "ኦክቶ", "ኖቬም", "ዲሴም", "" } }; yield return new object[] { "es-MX", new string[] { "ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sept", "oct", "nov", "dic", "" } }; // "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic.", "" @@ -200,7 +200,7 @@ public static IEnumerable AbbreviatedMonthGenitiveNames_Get_TestData_H yield return new object[] { "tr-CY", new string[] { "Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara", "" } }; yield return new object[] { "tr-TR", new string[] { "Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara", "" } }; yield return new object[] { "uk-UA", new string[] { "січ.", "лют.", "бер.", "квіт.", "трав.", "черв.", "лип.", "серп.", "вер.", "жовт.", "лист.", "груд.", "" } }; - string vietnameseAbbrMonth = PlatformDetection.IsFirefox ? "Thg" : "Tháng"; // thg + string vietnameseAbbrMonth = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "Thg" : "Tháng"; // thg yield return new object[] { "vi-VN", new string[] { $"{vietnameseAbbrMonth} 1", $"{vietnameseAbbrMonth} 2", $"{vietnameseAbbrMonth} 3", $"{vietnameseAbbrMonth} 4", $"{vietnameseAbbrMonth} 5", $"{vietnameseAbbrMonth} 6", $"{vietnameseAbbrMonth} 7", $"{vietnameseAbbrMonth} 8", $"{vietnameseAbbrMonth} 9", $"{vietnameseAbbrMonth} 10", $"{vietnameseAbbrMonth} 11", $"{vietnameseAbbrMonth} 12", "" } }; yield return new object[] { "zh-CN", new string[] { "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月", "" } }; yield return new object[] { "zh-Hans-HK", new string[] { "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月", "" } }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthNames.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthNames.cs index 186977451db44..f6cf0de76cf1e 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthNames.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthNames.cs @@ -32,7 +32,7 @@ public static IEnumerable AbbreviatedMonthNames_Get_TestData_HybridGlo { // see the comments on the right to check the non-Hybrid result, if it differs yield return new object[] { "ar-SA", new string[] { "محرم", "صفر", "ربيع الأول", "ربيع الآخر", "جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدة", "ذو الحجة", "" } }; - if (PlatformDetection.IsFirefox) + if (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) { yield return new object[] { "am-ET", new string[] { "ጃንዩ", "ፌብሩ", "ማርች", "ኤፕሪ", "ሜይ", "ጁን", "ጁላይ", "ኦገስ", "ሴፕቴ", "ኦክቶ", "ኖቬም", "ዲሴም", "" } }; yield return new object[] { "en-AU", new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec", "" } }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoFullDateTimePattern.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoFullDateTimePattern.cs index a0b998ac31b3e..2f754cdd9ee1e 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoFullDateTimePattern.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoFullDateTimePattern.cs @@ -28,10 +28,10 @@ public static IEnumerable FullDateTimePattern_Get_TestData_HybridGloba { yield return new object[] { new CultureInfo("ar-SA").DateTimeFormat, "dddd، d MMMM yyyy h:mm:ss tt" }; // dddd، d MMMM yyyy g h:mm:ss tt yield return new object[] { new CultureInfo("am-ET").DateTimeFormat, "yyyy MMMM d, dddd h:mm:ss tt" }; - yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, PlatformDetection.IsFirefox ? "dddd, d MMMM yyyy г. H:mm:ss ч." : "dddd, d MMMM yyyy г. H:mm:ss" }; // dddd, d MMMM yyyy 'г'. H:mm:ss + yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d MMMM yyyy г. H:mm:ss ч." : "dddd, d MMMM yyyy г. H:mm:ss" }; // dddd, d MMMM yyyy 'г'. H:mm:ss yield return new object[] { new CultureInfo("bn-BD").DateTimeFormat, "dddd, d MMMM, yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("bn-IN").DateTimeFormat, "dddd, d MMMM, yyyy h:mm:ss tt" }; - string catalanPattern = PlatformDetection.IsFirefox ? "dddd, d de MMMM de yyyy H:mm:ss" : "dddd, d de MMMM del yyyy H:mm:ss"; + string catalanPattern = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d de MMMM de yyyy H:mm:ss" : "dddd, d de MMMM del yyyy H:mm:ss"; yield return new object[] { new CultureInfo("ca-AD").DateTimeFormat, catalanPattern }; // dddd, d MMMM 'de' yyyy H:mm:ss yield return new object[] { new CultureInfo("ca-ES").DateTimeFormat, catalanPattern }; // dddd, d MMMM 'de' yyyy H:mm:ss yield return new object[] { new CultureInfo("cs-CZ").DateTimeFormat, "dddd d. MMMM yyyy H:mm:ss" }; @@ -50,7 +50,7 @@ public static IEnumerable FullDateTimePattern_Get_TestData_HybridGloba yield return new object[] { new CultureInfo("en-AI").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-AS").DateTimeFormat, "dddd, MMMM d, yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-AT").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; - yield return new object[] { new CultureInfo("en-AU").DateTimeFormat, PlatformDetection.IsFirefox ? "dddd, d MMMM yyyy h:mm:ss tt" : "dddd d MMMM yyyy h:mm:ss tt" }; + yield return new object[] { new CultureInfo("en-AU").DateTimeFormat, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d MMMM yyyy h:mm:ss tt" : "dddd d MMMM yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-BB").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-BE").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-BI").DateTimeFormat, "dddd, MMMM d, yyyy HH:mm:ss" }; @@ -73,7 +73,7 @@ public static IEnumerable FullDateTimePattern_Get_TestData_HybridGloba yield return new object[] { new CultureInfo("en-FJ").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-FK").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-FM").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; - yield return new object[] { new CultureInfo("en-GB").DateTimeFormat, PlatformDetection.IsFirefox ? "dddd, d MMMM yyyy HH:mm:ss" : "dddd d MMMM yyyy HH:mm:ss" }; + yield return new object[] { new CultureInfo("en-GB").DateTimeFormat, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d MMMM yyyy HH:mm:ss" : "dddd d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-GD").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-GG").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-GH").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; @@ -85,7 +85,7 @@ public static IEnumerable FullDateTimePattern_Get_TestData_HybridGloba yield return new object[] { new CultureInfo("en-IE").DateTimeFormat, "dddd d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-IL").DateTimeFormat, "dddd, d MMMM yyyy H:mm:ss" }; yield return new object[] { new CultureInfo("en-IM").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; - yield return new object[] { new CultureInfo("en-IN").DateTimeFormat, PlatformDetection.IsFirefox ? "dddd, d MMMM, yyyy h:mm:ss tt" : "dddd d MMMM, yyyy h:mm:ss tt" }; + yield return new object[] { new CultureInfo("en-IN").DateTimeFormat, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d MMMM, yyyy h:mm:ss tt" : "dddd d MMMM, yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-IO").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-JE").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; yield return new object[] { new CultureInfo("en-JM").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; @@ -147,7 +147,7 @@ public static IEnumerable FullDateTimePattern_Get_TestData_HybridGloba yield return new object[] { new CultureInfo("en-ZA").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; // dddd, dd MMMM yyyy HH:mm:ss yield return new object[] { new CultureInfo("en-ZM").DateTimeFormat, "dddd, d MMMM yyyy h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-ZW").DateTimeFormat, "dddd, d MMMM yyyy HH:mm:ss" }; // dddd, dd MMMM yyyy HH:mm:ss - string latinAmericaSpanishFormat = PlatformDetection.IsFirefox ? "dddd, d de MMMM de yyyy HH:mm:ss" : "dddd, d de MMMM de yyyy h:mm:ss tt"; // dddd, d 'de' MMMM 'de' yyyy HH:mm:ss + string latinAmericaSpanishFormat = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d de MMMM de yyyy HH:mm:ss" : "dddd, d de MMMM de yyyy h:mm:ss tt"; // dddd, d 'de' MMMM 'de' yyyy HH:mm:ss yield return new object[] { new CultureInfo("es-419").DateTimeFormat, latinAmericaSpanishFormat }; yield return new object[] { new CultureInfo("es-ES").DateTimeFormat, "dddd, d de MMMM de yyyy H:mm:ss" }; // dddd, d 'de' MMMM 'de' yyyy H:mm:ss yield return new object[] { new CultureInfo("es-MX").DateTimeFormat, latinAmericaSpanishFormat }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetAbbreviatedEraName.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetAbbreviatedEraName.cs index 9b41129d472d3..f9ced6cc2975e 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetAbbreviatedEraName.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetAbbreviatedEraName.cs @@ -199,7 +199,7 @@ public static IEnumerable GetAbbreviatedEraName_TestData() yield return new object[] { "tr-CY", 1, "MS" }; yield return new object[] { "tr-TR", 1, "MS" }; yield return new object[] { "uk-UA", 1, "н.е." }; - yield return new object[] { "vi-VN", 1, PlatformDetection.IsFirefox ? "sau CN" : "CN" }; // sau CN + yield return new object[] { "vi-VN", 1, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "sau CN" : "CN" }; // sau CN yield return new object[] { "zh-CN", 1, "公元" }; yield return new object[] { "zh-Hans-HK", 1, "公元" }; yield return new object[] { "zh-SG", 1, "公元" }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetEraName.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetEraName.cs index 9b97330ef0f4d..ccfce650b45c9 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetEraName.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoGetEraName.cs @@ -387,8 +387,8 @@ public static IEnumerable GetEraName_TestData() yield return new object[] { "tr-TR", 1, "MS" }; yield return new object[] { "uk-UA", 0, "н. е." }; yield return new object[] { "uk-UA", 1, "н. е." }; - yield return new object[] { "vi-VN", 0, PlatformDetection.IsFirefox ? "CN" : "SCN" }; // sau CN - yield return new object[] { "vi-VN", 1, PlatformDetection.IsFirefox ? "CN" : "SCN" }; // sau CN + yield return new object[] { "vi-VN", 0, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "CN" : "SCN" }; // sau CN + yield return new object[] { "vi-VN", 1, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "CN" : "SCN" }; // sau CN yield return new object[] { "zh-CN", 0, "公元" }; yield return new object[] { "zh-CN", 1, "公元" }; yield return new object[] { "zh-Hans-HK", 0, "公元" }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongDatePattern.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongDatePattern.cs index 1e2a7ca09b71b..4c6dc36ab8953 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongDatePattern.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongDatePattern.cs @@ -33,7 +33,7 @@ public static IEnumerable LongDatePattern_Get_TestData_HybridGlobaliza yield return new object[] {"bg-BG", "dddd, d MMMM yyyy г." }; // "dddd, d MMMM yyyy 'г'." yield return new object[] {"bn-BD", "dddd, d MMMM, yyyy" }; yield return new object[] {"bn-IN", "dddd, d MMMM, yyyy" }; - string catalanianPattern = PlatformDetection.IsFirefox ? "dddd, d de MMMM de yyyy" : "dddd, d de MMMM del yyyy"; // "dddd, d MMMM 'de' yyyy" + string catalanianPattern = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d de MMMM de yyyy" : "dddd, d de MMMM del yyyy"; // "dddd, d MMMM 'de' yyyy" yield return new object[] {"ca-AD", catalanianPattern }; yield return new object[] {"ca-ES", catalanianPattern }; yield return new object[] {"cs-CZ", "dddd d. MMMM yyyy" }; @@ -52,7 +52,7 @@ public static IEnumerable LongDatePattern_Get_TestData_HybridGlobaliza yield return new object[] {"en-AI", "dddd, d MMMM yyyy" }; yield return new object[] {"en-AS", "dddd, MMMM d, yyyy" }; yield return new object[] {"en-AT", "dddd, d MMMM yyyy" }; - yield return new object[] {"en-AU", PlatformDetection.IsFirefox ? "dddd, d MMMM yyyy" : "dddd d MMMM yyyy" }; + yield return new object[] {"en-AU", (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d MMMM yyyy" : "dddd d MMMM yyyy" }; yield return new object[] {"en-BB", "dddd, d MMMM yyyy" }; yield return new object[] {"en-BE", "dddd, d MMMM yyyy" }; yield return new object[] {"en-BI", "dddd, MMMM d, yyyy" }; @@ -75,7 +75,7 @@ public static IEnumerable LongDatePattern_Get_TestData_HybridGlobaliza yield return new object[] {"en-FJ", "dddd, d MMMM yyyy" }; yield return new object[] {"en-FK", "dddd, d MMMM yyyy" }; yield return new object[] {"en-FM", "dddd, d MMMM yyyy" }; - yield return new object[] {"en-GB", PlatformDetection.IsFirefox ? "dddd, d MMMM yyyy" :"dddd d MMMM yyyy" }; + yield return new object[] {"en-GB", (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d MMMM yyyy" :"dddd d MMMM yyyy" }; yield return new object[] {"en-GD", "dddd, d MMMM yyyy" }; yield return new object[] {"en-GG", "dddd, d MMMM yyyy" }; yield return new object[] {"en-GH", "dddd, d MMMM yyyy" }; @@ -87,7 +87,7 @@ public static IEnumerable LongDatePattern_Get_TestData_HybridGlobaliza yield return new object[] {"en-IE", "dddd d MMMM yyyy" }; yield return new object[] {"en-IL", "dddd, d MMMM yyyy" }; yield return new object[] {"en-IM", "dddd, d MMMM yyyy" }; - yield return new object[] {"en-IN", PlatformDetection.IsFirefox ? "dddd, d MMMM, yyyy" : "dddd d MMMM, yyyy" }; // dddd, d MMMM, yyyy + yield return new object[] {"en-IN", (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dddd, d MMMM, yyyy" : "dddd d MMMM, yyyy" }; // dddd, d MMMM, yyyy yield return new object[] {"en-IO", "dddd, d MMMM yyyy" }; yield return new object[] {"en-JE", "dddd, d MMMM yyyy" }; yield return new object[] {"en-JM", "dddd, d MMMM yyyy" }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs index 122eff9b4a77e..7d1f93e6b0402 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoLongTimePattern.cs @@ -19,7 +19,7 @@ public static IEnumerable LongTimePattern_Get_TestData_HybridGlobaliza // see the comments on the right to check the non-Hybrid result, if it differs yield return new object[] { new CultureInfo("ar-SA").DateTimeFormat, "h:mm:ss tt" }; yield return new object[] { new CultureInfo("am-ET").DateTimeFormat, "h:mm:ss tt" }; - yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, PlatformDetection.IsFirefox ? "H:mm:ss ч." : "H:mm:ss" }; // H:mm:ss ч. + yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "H:mm:ss ч." : "H:mm:ss" }; // H:mm:ss ч. yield return new object[] { new CultureInfo("bn-BD").DateTimeFormat, "h:mm:ss tt" }; yield return new object[] { new CultureInfo("bn-IN").DateTimeFormat, "h:mm:ss tt" }; yield return new object[] { new CultureInfo("ca-AD").DateTimeFormat, "H:mm:ss" }; @@ -137,7 +137,7 @@ public static IEnumerable LongTimePattern_Get_TestData_HybridGlobaliza yield return new object[] { new CultureInfo("en-ZA").DateTimeFormat, "HH:mm:ss" }; yield return new object[] { new CultureInfo("en-ZM").DateTimeFormat, "h:mm:ss tt" }; yield return new object[] { new CultureInfo("en-ZW").DateTimeFormat, "HH:mm:ss" }; - string latinAmericaSpanishPattern = PlatformDetection.IsFirefox ? "HH:mm:ss" : "h:mm:ss tt"; // H:mm:ss + string latinAmericaSpanishPattern = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "HH:mm:ss" : "h:mm:ss tt"; // H:mm:ss yield return new object[] { new CultureInfo("es-419").DateTimeFormat, latinAmericaSpanishPattern }; yield return new object[] { new CultureInfo("es-ES").DateTimeFormat, "H:mm:ss" }; yield return new object[] { new CultureInfo("es-MX").DateTimeFormat, latinAmericaSpanishPattern }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthGenitiveNames.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthGenitiveNames.cs index 1c6784cfdfe41..b061d9e5b0dfb 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthGenitiveNames.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthGenitiveNames.cs @@ -35,7 +35,7 @@ public static IEnumerable MonthGenitiveNames_Get_TestData() { // see the comments on the right to check the non-Hybrid result, if it differs yield return new object[] { new CultureInfo("ar-SA").DateTimeFormat, new string[] { "محرم", "صفر", "ربيع الأول", "ربيع الآخر", "جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدة", "ذو الحجة", "" } }; - if (PlatformDetection.IsFirefox) + if ((PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS)) { yield return new object[] { new CultureInfo("am-ET").DateTimeFormat, new string[] { "ጃንዩወሪ", "ፌብሩወሪ", "ማርች", "ኤፕሪል", "ሜይ", "ጁን", "ጁላይ", "ኦገስት", "ሴፕቴምበር", "ኦክቶበር", "ኖቬምበር", "ዲሴምበር", "" } }; } diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthNames.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthNames.cs index d6644f92303b7..ebe060cbf5998 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthNames.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoMonthNames.cs @@ -32,7 +32,7 @@ public static IEnumerable MonthNames_Get_TestData_HybridGlobalization( { // see the comments on the right to check the non-Hybrid result, if it differs yield return new object[] { new CultureInfo("ar-SA").DateTimeFormat, new string[] { "محرم", "صفر", "ربيع الأول", "ربيع الآخر", "جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدة", "ذو الحجة", "" } }; - if (PlatformDetection.IsFirefox) + if (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) { yield return new object[] { new CultureInfo("am-ET").DateTimeFormat, new string[] { "ጃንዩወሪ", "ፌብሩወሪ", "ማርች", "ኤፕሪል", "ሜይ", "ጁን", "ጁላይ", "ኦገስት", "ሴፕቴምበር", "ኦክቶበር", "ኖቬምበር", "ዲሴምበር", "" } }; } diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoPMDesignator.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoPMDesignator.cs index 937dae6b7b248..dd4401c716481 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoPMDesignator.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoPMDesignator.cs @@ -137,7 +137,7 @@ public static IEnumerable PMDesignator_Get_TestData_HybridGlobalizatio yield return new object[] { new CultureInfo("en-ZA").DateTimeFormat, "pm" }; yield return new object[] { new CultureInfo("en-ZM").DateTimeFormat, "pm" }; yield return new object[] { new CultureInfo("en-ZW").DateTimeFormat, "pm" }; - string latinAmericaSpanishDesignator = PlatformDetection.IsFirefox ? "p.\u00A0m." : "p.m."; // p.m. + string latinAmericaSpanishDesignator = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "p.\u00A0m." : "p.m."; // p.m. yield return new object[] { new CultureInfo("es-419").DateTimeFormat, latinAmericaSpanishDesignator }; yield return new object[] { new CultureInfo("es-ES").DateTimeFormat, "p.\u00A0m." }; // p.m. yield return new object[] { new CultureInfo("es-MX").DateTimeFormat, latinAmericaSpanishDesignator }; @@ -189,7 +189,7 @@ public static IEnumerable PMDesignator_Get_TestData_HybridGlobalizatio yield return new object[] { new CultureInfo("sw-KE").DateTimeFormat, "PM" }; yield return new object[] { new CultureInfo("sw-TZ").DateTimeFormat, "PM" }; yield return new object[] { new CultureInfo("sw-UG").DateTimeFormat, "PM" }; - string tamilDesignator = PlatformDetection.IsFirefox ? "பிற்பகல்" : "PM"; // பிற்பகல் + string tamilDesignator = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "பிற்பகல்" : "PM"; // பிற்பகல் yield return new object[] { new CultureInfo("ta-IN").DateTimeFormat, tamilDesignator }; yield return new object[] { new CultureInfo("ta-LK").DateTimeFormat, tamilDesignator }; yield return new object[] { new CultureInfo("ta-MY").DateTimeFormat, tamilDesignator }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs index c4e3dbcbdc3bc..b3816b5a4b050 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortDatePattern.cs @@ -101,7 +101,7 @@ public static IEnumerable ShortDatePattern_Get_TestData_HybridGlobaliz yield return new object[] { "en-NL", "dd/MM/yyyy" }; yield return new object[] { "en-NR", "dd/MM/yyyy" }; yield return new object[] { "en-NU", "dd/MM/yyyy" }; - yield return new object[] { "en-NZ", PlatformDetection.IsFirefox ? "d/MM/yyyy" : "dd/MM/yyyy" }; // "d/MM/yyyy" + yield return new object[] { "en-NZ", (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "d/MM/yyyy" : "dd/MM/yyyy" }; // "d/MM/yyyy" yield return new object[] { "en-PG", "dd/MM/yyyy" }; yield return new object[] { "en-PH", "M/d/yyyy" }; // "dd/MM/yyyy" yield return new object[] { "en-PK", "dd/MM/yyyy" }; @@ -179,7 +179,7 @@ public static IEnumerable ShortDatePattern_Get_TestData_HybridGlobaliz yield return new object[] { "ro-RO", "dd.MM.yyyy" }; yield return new object[] { "ru-RU", "dd.MM.yyyy" }; yield return new object[] { "sk-SK", "d. M. yyyy" }; - yield return new object[] { "sl-SI", PlatformDetection.IsFirefox ? "d. MM. yyyy" : "d. M. yyyy" }; // "d. MM. yyyy" + yield return new object[] { "sl-SI", (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "d. MM. yyyy" : "d. M. yyyy" }; // "d. MM. yyyy" yield return new object[] { "sr-Cyrl-RS", "d.M.yyyy." }; yield return new object[] { "sr-Latn-RS", "d.M.yyyy." }; yield return new object[] { "sv-AX", "yyyy-MM-dd" }; @@ -197,7 +197,7 @@ public static IEnumerable ShortDatePattern_Get_TestData_HybridGlobaliz yield return new object[] { "tr-CY", "d.MM.yyyy" }; yield return new object[] { "tr-TR", "d.MM.yyyy" }; yield return new object[] { "uk-UA", "dd.MM.yyyy" }; - yield return new object[] { "vi-VN", PlatformDetection.IsFirefox ? "dd/MM/yyyy" : "d/M/yyyy" }; // "dd/MM/yyyy" + yield return new object[] { "vi-VN", (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "dd/MM/yyyy" : "d/M/yyyy" }; // "dd/MM/yyyy" yield return new object[] { "zh-CN", "yyyy/M/d" }; yield return new object[] { "zh-Hans-HK", "d/M/yyyy" }; yield return new object[] { "zh-SG", "dd/MM/yyyy" }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs index e9a891fb7ade7..adb8c90d5cdf8 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortTimePattern.cs @@ -138,7 +138,7 @@ public static IEnumerable ShortTimePattern_Get_TestData_HybridGlobaliz yield return new object[] { new CultureInfo("en-ZM").DateTimeFormat, "h:mm tt" }; yield return new object[] { new CultureInfo("en-ZW").DateTimeFormat, "HH:mm" }; yield return new object[] { new CultureInfo("en-US").DateTimeFormat, "h:mm tt" }; - string latinAmericanSpanishPattern = PlatformDetection.IsFirefox ? "HH:mm" : "h:mm tt"; // "HH:mm" + string latinAmericanSpanishPattern = (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "HH:mm" : "h:mm tt"; // "HH:mm" yield return new object[] { new CultureInfo("es-419").DateTimeFormat, latinAmericanSpanishPattern }; yield return new object[] { new CultureInfo("es-ES").DateTimeFormat, "H:mm" }; yield return new object[] { new CultureInfo("es-MX").DateTimeFormat, latinAmericanSpanishPattern }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortestDayNames.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortestDayNames.cs index 357762222de8c..f99c694d3bb2f 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortestDayNames.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoShortestDayNames.cs @@ -34,7 +34,7 @@ public static IEnumerable ShortestDayNames_Get_TestData_HybridGlobaliz yield return new object[] { new CultureInfo("am-ET").DateTimeFormat, new string[] { "እ", "ሰ", "ማ", "ረ", "ሐ", "ዓ", "ቅ" } }; yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, new string[] { "н", "п", "в", "с", "ч", "п", "с" } }; yield return new object[] { new CultureInfo("bn-IN").DateTimeFormat, new string[] { "র", "সো", "ম", "বু", "বৃ", "শু", "শ" } }; - if (PlatformDetection.IsFirefox) + if (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) { yield return new object[] { new CultureInfo("ca-ES").DateTimeFormat, new string[] { "dg", "dl", "dt", "dc", "dj", "dv", "ds" } }; yield return new object[] { new CultureInfo("en-AU").DateTimeFormat, new string[] { "Su.", "M.", "Tu.", "W.", "Th.", "F.", "Sa." } }; diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoYearMonthPattern.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoYearMonthPattern.cs index f445f291754d0..a79c812900470 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoYearMonthPattern.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoYearMonthPattern.cs @@ -17,7 +17,7 @@ public static IEnumerable YearMonthPattern_Get_TestData() // see the comments on the right to check the non-Hybrid result, if it differs yield return new object[] { new CultureInfo("ar-SA").DateTimeFormat, "MMMM yyyy" }; // "MMMM yyyy g" yield return new object[] { new CultureInfo("bg-BG").DateTimeFormat, "MMMM yyyy \u0433." }; // ICU: "MMMM yyyy '\u0433'." - yield return new object[] { new CultureInfo("ca-AD").DateTimeFormat, PlatformDetection.IsFirefox ? "MMMM de yyyy" : "MMMM del yyyy" }; // ICU: "MMMM 'de' yyyy" + yield return new object[] { new CultureInfo("ca-AD").DateTimeFormat, (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) ? "MMMM de yyyy" : "MMMM del yyyy" }; // ICU: "MMMM 'de' yyyy" yield return new object[] { new CultureInfo("es-419").DateTimeFormat, "MMMM de yyyy" }; // ICU: "MMMM 'de' yyyy" yield return new object[] { new CultureInfo("es-ES").DateTimeFormat, "MMMM de yyyy" }; // ICU: "MMMM 'de' yyyy" yield return new object[] { new CultureInfo("es-MX").DateTimeFormat, "MMMM de yyyy" }; // ICU: "MMMM 'de' yyyy" From bde67d1a9ad11e2f8143759faf8c78f91a929c41 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 25 Jun 2024 12:50:41 +0000 Subject: [PATCH 4/4] Remove duplicated code. --- .../DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs index baaf9a5b051fc..99adfce5c1602 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/DateTimeFormatInfo/DateTimeFormatInfoAbbreviatedMonthGenitiveNames.cs @@ -13,7 +13,6 @@ public static IEnumerable AbbreviatedMonthGenitiveNames_Get_TestData_H // see the comments on the right to check the non-Hybrid result, if it differs yield return new object[] { "ar-SA", new string[] { "محرم", "صفر", "ربيع الأول", "ربيع الآخر", "جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان", "رمضان", "شوال", "ذو القعدة", "ذو الحجة", "" } }; if (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) - if (PlatformDetection.IsFirefox || PlatformDetection.IsNodeJS) { yield return new object[] { "am-ET", new string[] { "ጃንዩ", "ፌብሩ", "ማርች", "ኤፕሪ", "ሜይ", "ጁን", "ጁላይ", "ኦገስ", "ሴፕቴ", "ኦክቶ", "ኖቬም", "ዲሴም", "" } }; yield return new object[] { "es-MX", new string[] { "ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sept", "oct", "nov", "dic", "" } }; // "ene.", "feb.", "mar.", "abr.", "may.", "jun.", "jul.", "ago.", "sep.", "oct.", "nov.", "dic.", ""