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

Add test for string.Concat(object) that ToString returns null #36436

Merged
merged 1 commit into from
Apr 9, 2019
Merged
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
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 @@ -371,8 +371,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 @@ -399,6 +397,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