Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Add test for string.Concat(object) that ToString returns null (#36436)
Browse files Browse the repository at this point in the history
  • Loading branch information
safern authored Apr 9, 2019
1 parent 3f7071d commit f9c9710
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Common/tests/Tests/System/StringTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,6 @@ public static IEnumerable<object[]> Concat_Objects_TestData()

yield return new object[] { new object[] { 1 }, "1" };
yield return new object[] { new object[] { null }, "" };
// dotnet/coreclr#6785, this will be null for the Concat(object) overload but "" for the object[]/IEnumerable<object> overload
// yield return new object[] { new object[] { new ObjectWithNullToString() }, "" };

yield return new object[] { new object[] { 1, 2 }, "12" };
yield return new object[] { new object[] { null, 1 }, "1" };
Expand All @@ -400,6 +398,11 @@ public static IEnumerable<object[]> Concat_Objects_TestData()

// Concat should ignore objects that have a null ToString() value
yield return new object[] { new object[] { new ObjectWithNullToString(), "Foo", new ObjectWithNullToString(), "Bar", new ObjectWithNullToString() }, "FooBar" };

if (!PlatformDetection.IsFullFramework)
{
yield return new object[] { new object[] { new ObjectWithNullToString() }, "" };
}
}

[Theory]
Expand Down

0 comments on commit f9c9710

Please sign in to comment.