Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-anon-50.cs
1 // Compiler options: -langversion:default
2
3 using System;
4 using System.Collections;
5
6 public class Test
7 {
8         public IEnumerable Foo (int a)
9         {
10                 yield return a;
11                 yield return a * a;
12                 yield break;
13         }
14 }
15
16 class X
17 {
18         public static int Main ()
19         {
20                 Test test = new Test ();
21
22                 IEnumerable a = test.Foo (5);
23
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;
33
34                 IEnumerator d = a.GetEnumerator ();
35
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;
44
45                 if (c.MoveNext ())
46                         return 13;
47
48                 ((IDisposable) a).Dispose ();
49                 return 0;
50         }
51 }