2009-12-09 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / test-anon-50.cs
blob72c046e357418910bba54b31e1ac505f84490a0e
1 // Compiler options: -langversion:default
3 using System;
4 using System.Collections;
6 public class Test
8 public IEnumerable Foo (int a)
10 yield return a;
11 yield return a * a;
12 yield break;
16 class X
18 static int Main ()
20 Test test = new Test ();
22 IEnumerable a = test.Foo (5);
24 IEnumerator c = a.GetEnumerator ();
25 if (!c.MoveNext ())
26 return 5;
27 if ((int) c.Current != 5)
28 return 6;
29 if (!c.MoveNext ())
30 return 7;
31 if ((int) c.Current != 25)
32 return 8;
34 IEnumerator d = a.GetEnumerator ();
36 if ((int) c.Current != 25)
37 return 9;
38 if (!d.MoveNext ())
39 return 10;
40 if ((int) c.Current != 25)
41 return 11;
42 if ((int) d.Current != 5)
43 return 12;
45 if (c.MoveNext ())
46 return 13;
48 ((IDisposable) a).Dispose ();
49 return 0;