← Back to team overview

nunit-core team mailing list archive

Re: [Bug 1051847] Re: self contained item in array causes stack overflow

 

Never mind... I see you did a branch.

Charlie

On Wed, Sep 19, 2012 at 3:13 PM, Charlie Poole <charlie@xxxxxxxxx> wrote:
> Sounds cool. If you don't want to do a separate branch just send me
> the files you changed.
>
> Charlie
>
> On Wed, Sep 19, 2012 at 1:53 PM, Simone Busoli
> <1051847@xxxxxxxxxxxxxxxxxx> wrote:
>> I've done a simple implementation which allows for the usage specified
>> by the OP and in general considers enumerables which introduce recursion
>> as not equal.
>>
>> Not sure it is really worth to add real support for recursive
>> enumerables and for explicity identity comparison in Contains
>> constraint, maybe the second is more desirable than the first though.
>>
>> --
>> You received this bug notification because you are subscribed to NUnit
>> Extended Testing Platform.
>> https://bugs.launchpad.net/bugs/1051847
>>
>> Title:
>>   self contained item in array causes stack overflow
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/nunitv2/+bug/1051847/+subscriptions

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1051847

Title:
  self contained item in array causes stack overflow

Status in NUnit V2 Test Framework:
  Confirmed

Bug description:
  using System.Collections;
  using System.Collections.Generic;
  using NUnit.Framework;

  [TestFixture]
  public class Reproduction {
  	class SelfContainer : IEnumerable { public IEnumerator GetEnumerator() { yield return this; } }

  	[Test]
  	public void SelfContainedItemFoundInArray() {
  		var item = new SelfContainer();
  		var items = new SelfContainer[] { new SelfContainer(), item };

  		// work around
  		Assert.True(((ICollection<SelfContainer>)items).Contains(item));

  		// causes StackOverflowException
  		Assert.Contains(item, items);
  	}
  }

  Reproduced in NUnit 2.6.1

  See also bug #491300

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1051847/+subscriptions


Follow ups

References