linux-packaging-mono/mcs/tests/test-anon-50.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

52 lines
781 B
C#

// Compiler options: -langversion:default
using System;
using System.Collections;
public class Test
{
public IEnumerable Foo (int a)
{
yield return a;
yield return a * a;
yield break;
}
}
class X
{
public static int Main ()
{
Test test = new Test ();
IEnumerable a = test.Foo (5);
IEnumerator c = a.GetEnumerator ();
if (!c.MoveNext ())
return 5;
if ((int) c.Current != 5)
return 6;
if (!c.MoveNext ())
return 7;
if ((int) c.Current != 25)
return 8;
IEnumerator d = a.GetEnumerator ();
if ((int) c.Current != 25)
return 9;
if (!d.MoveNext ())
return 10;
if ((int) c.Current != 25)
return 11;
if ((int) d.Current != 5)
return 12;
if (c.MoveNext ())
return 13;
((IDisposable) a).Dispose ();
return 0;
}
}