[mono/tests] Fix out of tree build.
[mono-project.git] / mcs / tests / test-anon-96.cs
blob97ff41cf2c8f42595d5abd3001f19f7f864479ac
1 using System;
3 class P
5 public int A;
8 static class Program
10 static int Extra () { return 36; }
12 delegate int D ();
14 static D Get (int dummy)
16 var p = new P { A = 6 };
17 switch (dummy) {
18 case 0:
19 int extra = Extra ();
20 return () => p.A + extra;
21 case 1:
22 extra = 9;
23 return () => p.A * extra;
24 case 2:
25 return () => p.A * 2;
27 throw new NotSupportedException ();
30 static int Run (int i)
32 return Get (i) ();
35 public static int Main ()
37 if (Run (0) != 42)
38 return 1;
40 if (Run (1) != 54)
41 return 2;
43 if (Run (2) != 12)
44 return 3;
46 if (Run (1) != 54)
47 return 4;
49 if (Run (0) != 42)
50 return 5;
52 return 0;