Compare commits

...
1 Commits
Author SHA1 Message Date
Alexander Kyte 659458b3ad [runtime] Add test for equal enumerators bug 2017-09-15 17:12:23 +00:00
@@ -222,6 +222,26 @@ namespace MonoTests.System.Linq {
Assert.Fail ("Unexpected element: " + ea.Current);
}
[Test]
public void EqualEnumerators ()
{
// https://bugzilla.xamarin.com/show_bug.cgi?id=59335
//
// On .NET, multiple enumerators made from an EmptyEnumerable
// are equal. Object.ReferenceEquals is true for both instances returned.
// When made from an empty array or other empty collection,
// they are not equal.
var specialBase = Enumerable.Empty<int> ();
var normalBase = Array.Empty<int> ();
var firstSpecial = specialBase.GetEnumerator ();
var secondSpecial = specialBase.GetEnumerator ();
var firstNormal = normalBase.GetEnumerator ();
var secondNormal = normalBase.GetEnumerator ();
Assert.IsTrue (!object.ReferenceEquals (firstNormal, secondNormal));
Assert.IsTrue (object.ReferenceEquals (firstSpecial, secondSpecial));
}
[Test]
public void FirstArgumentNullTest ()
{