[w32file] Move MonoIO.Find{First,Next,Close} to managed
[mono.git] / mcs / tests / gtest-lambda-31.cs
1 // Compiler options: -optimize
2
3 // Check lambdas to method group optimization, no lambdas should be created for any code int this test
4
5 using System;
6 using System.Collections;
7 using System.Linq;
8
9 class Test
10 {
11         static int Prop {
12                 get {
13                         return 4;
14                 }
15         }
16
17         public static int Main ()
18         {
19                 var parsed = from t in new[] { "2" } select int.Parse (t);
20                 if (parsed.First () != 2)
21                         return 1;
22
23                 var s = new string[] { "x", "a" };
24                 Array.Sort (s, (a, b) => String.Compare (a, b));
25                 if (s[0] != "a")
26                         return 10;
27
28                 if (s[1] != "x")
29                         return 11;
30
31                 Func<int> i = () => Prop;
32                 if (i () != 4)
33                         return 20;
34
35                 var em = new IEnumerable[] { new int[] { 1 } }.Select (l => l.Cast<int> ()).First ().First ();
36                 if (em != 1)
37                         return 30;
38
39                 Console.WriteLine ("ok");
40                 return 0;
41         }
42 }