[mono/tests] Fix out of tree build.
[mono-project.git] / mcs / tests / test-anon-169.cs
blob5e7aff0941fd85cb414f6427069f109a0cdebc36
1 using System;
2 using System.Collections.Generic;
4 static class Test
6 public static int Main ()
8 var fs = new List<Func<int>> ();
10 foreach (int i in new List<int> () { 1, 2, 3 }) {
11 fs.Add (() => i);
14 int total = 0;
15 foreach (var i in fs) {
16 total += i ();
17 Console.WriteLine (i ());
20 if (total != 6)
21 return 1;
23 var fs2 = new List<Func<char>> ();
24 total = 0;
25 foreach (var i in fs2) {
26 total += i ();
27 Console.WriteLine (i ());
30 foreach (var i in "abcd") {
31 fs2.Add (() => i);
34 string concat = "";
35 foreach (var i in fs2) {
36 concat += i ();
37 Console.WriteLine (i ());
40 if (concat != "abcd")
41 return 2;
43 return 0;