From ffaf8f2ccd2a20d4942b9ed515787e440bcb5161 Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Thu, 20 Jun 2019 15:18:57 -0700 Subject: [PATCH] Update StringTests for Span.ToLower/Upper with null culture (dotnet/corefx#38692) * Update StringTests for Span.ToLower/Upper with null culture * Darc update for dotnet/coreclr from build 20190619.2 * Darc update for dotnet/coreclr from build 20190620.2 Commit migrated from https://github.com/dotnet/corefx/commit/149bde31df743ba2a3d79a1944de411a8016acb4 --- .../Common/tests/Tests/System/StringTests.cs | 28 ++++------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/libraries/Common/tests/Tests/System/StringTests.cs b/src/libraries/Common/tests/Tests/System/StringTests.cs index 10e8a96..f151ec9 100644 --- a/src/libraries/Common/tests/Tests/System/StringTests.cs +++ b/src/libraries/Common/tests/Tests/System/StringTests.cs @@ -6715,20 +6715,15 @@ namespace System.Tests { // lower upper Culture yield return new object[] { "abcd", "ABCD", "en-US" }; + yield return new object[] { "abcd", "ABCD", null }; yield return new object[] { "latin i", "LATIN I", "en-US" }; + yield return new object[] { "latin i", "LATIN I", null }; + yield return new object[] { "", "", null }; yield return new object[] { "turky \u0131", "TURKY I", "tr-TR" }; yield return new object[] { "turky i", "TURKY \u0130", "tr-TR" }; yield return new object[] { "\ud801\udc29", PlatformDetection.IsWindows7 ? "\ud801\udc29" : "\ud801\udc01", "en-US" }; } - public static IEnumerable UpperLowerCasing_NullCulture_TestData() - { - // lower upper - yield return new object[] { "abcd", "ABCD" }; - yield return new object[] { "latin i", "LATIN I" }; - yield return new object[] { "", "" }; - } - public static IEnumerable StartEndWith_TestData() { // str1 Start End Culture ignorecase expected @@ -6787,7 +6782,7 @@ namespace System.Tests [MemberData(nameof(UpperLowerCasing_TestData))] public static void CasingTest(string lowerForm, string upperForm, string cultureName) { - CultureInfo ci = CultureInfo.GetCultureInfo(cultureName); + CultureInfo ci = cultureName != null ? CultureInfo.GetCultureInfo(cultureName) : null; Assert.Equal(lowerForm, upperForm.ToLower(ci)); Assert.Equal(upperForm, lowerForm.ToUpper(ci)); @@ -6805,21 +6800,6 @@ namespace System.Tests } [Theory] - [MemberData(nameof(UpperLowerCasing_NullCulture_TestData))] - public static void CasingTestNullCulture(string lowerForm, string upperForm) - { - Assert.Equal(lowerForm, upperForm.ToLower(null)); - Assert.Equal(upperForm, lowerForm.ToUpper(null)); - } - - [Fact] - public static void CasingAsSpan_NullCulture_ThrowsArgumentNullException() - { - Assert.Throws("culture", () => "".AsSpan().ToLower(new Span(), null)); - Assert.Throws("culture", () => "".AsSpan().ToUpper(new Span(), null)); - } - - [Theory] [MemberData(nameof(StartEndWith_TestData))] public static void StartEndWithTest(string source, string start, string end, string cultureName, bool ignoreCase, bool expected) { -- 2.7.4