Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static IEnumerable<object[]> EnglishName_TestData()
{
yield return new object[] { CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.EnglishName };

if (SupportFullGlobalizationData)
if (SupportFullGlobalizationData || PlatformDetection.IsHybridGlobalizationOnOSX)
{
yield return new object[] { "en-US", "English (United States)" };
yield return new object[] { "fr-FR", "French (France)" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ public static IEnumerable<object[]> NativeName_TestData()
yield return new object[] { CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.NativeName };

// Android has its own ICU, which doesn't 100% map to UsingLimitedCultures
if (PlatformDetection.IsNotUsingLimitedCultures || PlatformDetection.IsAndroid)
if (PlatformDetection.IsNotUsingLimitedCultures || PlatformDetection.IsAndroid || PlatformDetection.IsHybridGlobalizationOnOSX)
{
yield return new object[] { "en-US", "English (United States)" };
yield return new object[] { "en-CA", "English (Canada)" };
yield return new object[] { "en-GB", "English (United Kingdom)" };
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Xunit;
using System.Collections.Generic;

namespace System.Globalization.Tests
{
public class CultureInfoThreeLetterISOInfo
{
public static IEnumerable<object[]> RegionInfo_TestData()
{
yield return new object[] { 0x409, 244, "en-US", "USA", "eng" };
yield return new object[] { 0x411, 122, "ja-JP", "JPN", "jpn" };
yield return new object[] { 0x804, 45, "zh-CN", "CHN", "zho" };
yield return new object[] { 0x401, 205, "ar-SA", "SAU", "ara" };
yield return new object[] { 0x412, 134, "ko-KR", "KOR", "kor" };
yield return new object[] { 0x40d, 117, "he-IL", "ISR", "heb" };
}

[Theory]
[MemberData(nameof(RegionInfo_TestData))]
public void MiscTest(int lcid, int geoId, string name, string threeLetterISORegionName, string threeLetterISOLanguageName)
{
RegionInfo ri = new RegionInfo(lcid); // create it with lcid
Assert.Equal(geoId, ri.GeoId);
Assert.Equal(threeLetterISORegionName, ri.ThreeLetterISORegionName);
Assert.Equal(threeLetterISOLanguageName, new CultureInfo(name).ThreeLetterISOLanguageName);
}
}
}
48 changes: 0 additions & 48 deletions src/libraries/System.Globalization/tests/Hybrid/HybridMode.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,44 @@
<HybridGlobalization>true</HybridGlobalization>
</PropertyGroup>
<ItemGroup>
<Compile Include="HybridMode.cs" />
<Compile Include="..\CultureInfo\CultureInfoEnglishName.cs" />
<Compile Include="..\CultureInfo\CultureInfoNumberFormat.cs" />
<Compile Include="..\CultureInfo\CultureInfoNames.cs" />
<Compile Include="..\CultureInfo\CultureInfoNativeName.cs" />
<Compile Include="..\CultureInfo\CultureInfoParent.cs" />
<Compile Include="..\CultureInfo\CultureInfoThreeLetterISOInfo.cs" />
<Compile Include="..\CultureInfo\CultureInfoTwoLetterISOLanguageName.cs" />
<Compile Include="..\CompareInfo\CompareInfoTestsBase.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.Compare.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.IndexOf.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.IsPrefix.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.IsSuffix.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.LastIndexOf.cs" />
<Compile Include="..\DateTimeFormatInfo\DateTimeFormatInfoCalendarWeekRule.cs" />
<Compile Include="..\DateTimeFormatInfo\DateTimeFormatInfoData.cs" />
<Compile Include="..\DateTimeFormatInfo\DateTimeFormatInfoFirstDayOfWeek.cs" />
<Compile Include="..\DateTimeFormatInfo\DateTimeFormatInfoCalendarWeekRule.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoValidateParseStyle.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoData.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoCurrencySymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoData.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNaNSymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentGroupSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentDecimalSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentDecimalDigits.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPerMilleSymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentSymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPositiveSign.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPositiveInfinitySymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNegativeSign.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNegativeInfinitySymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNumberGroupSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNumberDecimalSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNegativeSign.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNumberDecimalDigits.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNumberDecimalSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNumberGroupSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNumberGroupSizes.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoNumberNegativePattern.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentNegativePattern.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentDecimalDigits.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentDecimalSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentGroupSeparator.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentGroupSizes.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentNegativePattern.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentPositivePattern.cs" />
<Compile Include="..\CompareInfo\CompareInfoTestsBase.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.Compare.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.IndexOf.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.LastIndexOf.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.IsPrefix.cs" />
<Compile Include="..\CompareInfo\CompareInfoTests.IsSuffix.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPercentSymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPerMilleSymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPositiveInfinitySymbol.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoPositiveSign.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoTests.cs" />
<Compile Include="..\NumberFormatInfo\NumberFormatInfoValidateParseStyle.cs" />
<Compile Include="..\System\Globalization\TextInfoTests.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,11 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Nls.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.Utf8.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.WebAssembly.cs" Condition="'$(TargetsBrowser)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.OSX.cs" Condition="'$(IsOSXLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareInfo.iOS.cs" Condition="'$(IsiOSLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CompareOptions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.Icu.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.OSX.cs" Condition="'$(IsOSXLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.iOS.cs" Condition="'$(IsiOSLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureData.Nls.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureNotFoundException.cs" />
Expand Down Expand Up @@ -391,7 +391,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.Icu.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.Nls.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.OSX.cs" Condition="'$(IsOSXLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.iOS.cs" Condition="'$(IsiOSLike)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TextInfo.WebAssembly.cs" Condition="'$(TargetsBrowser)' == 'true'" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\ThaiBuddhistCalendar.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TimeSpanFormat.cs" />
Expand Down Expand Up @@ -1290,14 +1290,14 @@
<Compile Include="$(CommonPath)Interop\Interop.Casing.cs">
<Link>Common\Interop\Interop.Casing.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Casing.OSX.cs" Condition="'$(IsOSXLike)' == 'true'">
<Link>Common\Interop\Interop.Casing.OSX.cs</Link>
<Compile Include="$(CommonPath)Interop\Interop.Casing.iOS.cs" Condition="'$(IsiOSLike)' == 'true'">
<Link>Common\Interop\Interop.Casing.iOS.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Collation.cs">
<Link>Common\Interop\Interop.Collation.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Collation.OSX.cs" Condition="'$(IsOSXLike)' == 'true'">
<Link>Common\Interop\Interop.Collation.OSX.cs</Link>
<Compile Include="$(CommonPath)Interop\Interop.Collation.iOS.cs" Condition="'$(IsiOSLike)' == 'true'">
<Link>Common\Interop\Interop.Collation.iOS.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.ICU.cs">
<Link>Common\Interop\Interop.ICU.cs</Link>
Expand All @@ -1311,8 +1311,8 @@
<Compile Include="$(CommonPath)Interop\Interop.Locale.cs">
<Link>Common\Interop\Interop.Locale.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Locale.OSX.cs" Condition="'$(IsOSXLike)' == 'true'">
<Link>Common\Interop\Interop.Locale.OSX.cs</Link>
<Compile Include="$(CommonPath)Interop\Interop.Locale.iOS.cs" Condition="'$(IsiOSLike)' == 'true'">
<Link>Common\Interop\Interop.Locale.iOS.cs</Link>
</Compile>
<Compile Include="$(CommonPath)Interop\Interop.Normalization.cs">
<Link>Common\Interop\Interop.Normalization.cs</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private void IcuInitSortHandle(string interopCultureName)
_isAsciiEqualityOrdinal = GetIsAsciiEqualityOrdinal(interopCultureName);
if (!GlobalizationMode.Invariant)
{
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS || TARGET_BROWSER
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS || TARGET_BROWSER
if (GlobalizationMode.Hybrid)
return;
#endif
Expand Down Expand Up @@ -84,7 +84,7 @@ private unsafe int IcuIndexOfCore(ReadOnlySpan<char> source, ReadOnlySpan<char>
fixed (char* pSource = &MemoryMarshal.GetReference(source))
fixed (char* pTarget = &MemoryMarshal.GetReference(target))
{
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return IndexOfCoreNative(pTarget, target.Length, pSource, source.Length, options, fromBeginning, matchLengthPtr);
#endif
Expand Down Expand Up @@ -203,7 +203,7 @@ private unsafe int IndexOfOrdinalIgnoreCaseHelper(ReadOnlySpan<char> source, Rea
throw new Exception((string)ex_result);
return result;
}
#elif TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#elif TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return IndexOfCoreNative(b, target.Length, a, source.Length, options, fromBeginning, matchLengthPtr);
#endif
Expand Down Expand Up @@ -305,7 +305,7 @@ private unsafe int IndexOfOrdinalHelper(ReadOnlySpan<char> source, ReadOnlySpan<
throw new Exception((string)ex_result);
return result;
}
#elif TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#elif TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return IndexOfCoreNative(b, target.Length, a, source.Length, options, fromBeginning, matchLengthPtr);
#endif
Expand Down Expand Up @@ -337,7 +337,7 @@ private unsafe bool IcuStartsWith(ReadOnlySpan<char> source, ReadOnlySpan<char>
fixed (char* pSource = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced)
fixed (char* pPrefix = &MemoryMarshal.GetReference(prefix))
{
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return NativeStartsWith(pPrefix, prefix.Length, pSource, source.Length, options);
#endif
Expand Down Expand Up @@ -420,7 +420,7 @@ private unsafe bool StartsWithOrdinalIgnoreCaseHelper(ReadOnlySpan<char> source,
return true;

InteropCall:
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return NativeStartsWith(bp, prefix.Length, ap, source.Length, options);
#endif
Expand Down Expand Up @@ -492,7 +492,7 @@ private unsafe bool StartsWithOrdinalHelper(ReadOnlySpan<char> source, ReadOnlyS
return true;

InteropCall:
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return NativeStartsWith(bp, prefix.Length, ap, source.Length, options);
#endif
Expand Down Expand Up @@ -521,7 +521,7 @@ private unsafe bool IcuEndsWith(ReadOnlySpan<char> source, ReadOnlySpan<char> su
fixed (char* pSource = &MemoryMarshal.GetReference(source)) // could be null (or otherwise unable to be dereferenced)
fixed (char* pSuffix = &MemoryMarshal.GetReference(suffix))
{
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return NativeEndsWith(pSuffix, suffix.Length, pSource, source.Length, options);
#endif
Expand Down Expand Up @@ -605,7 +605,7 @@ private unsafe bool EndsWithOrdinalIgnoreCaseHelper(ReadOnlySpan<char> source, R
return true;

InteropCall:
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return NativeEndsWith(bp, suffix.Length, ap, source.Length, options);
#endif
Expand Down Expand Up @@ -677,7 +677,7 @@ private unsafe bool EndsWithOrdinalHelper(ReadOnlySpan<char> source, ReadOnlySpa
return true;

InteropCall:
#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
#if TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
if (GlobalizationMode.Hybrid)
return NativeEndsWith(bp, suffix.Length, ap, source.Length, options);
#endif
Expand Down
Loading