[jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to...
[mono.git] / mcs / tests / gtest-linq-10.cs
1
2
3 using System;
4 using System.Collections.Generic;
5 using System.Linq;
6
7 class DataA
8 {
9         public int Key;
10         public string Text;
11 }
12
13 class DataB
14 {
15         public int Key;
16         public string Value;    
17 }
18
19 class GroupJoin
20 {
21         public static int Main ()
22         {
23                 DataA[] d1 = new DataA[] { new DataA () { Key = 1, Text = "Foo" }};
24                 DataB[] d2 = new DataB[] { new DataB () { Key = 2, Value = "Second" }};
25                 
26                 var e = from a in d1
27                         join b in d2 on a.Key equals b.Key into ab
28                         from x in ab.DefaultIfEmpty ()
29                         select new { a = x == default (DataB) ? "<empty>" : x.Value, b = a.Text };
30
31                 var res = e.ToList ();
32                 if (res.Count != 1)
33                         return 1;
34                 
35                 if (res [0].a != "<empty>")
36                         return 2;
37                         
38                 if (res [0].b != "Foo")
39                         return 3;
40                         
41                 // Explicitly typed
42                 e = from a in d1
43                         join DataB b in d2 on a.Key equals b.Key into ab
44                         from x in ab.DefaultIfEmpty ()
45                         select new { a = x == default (DataB) ? "<empty>" : x.Value, b = a.Text };
46                         
47                 foreach (var o in e)
48                         Console.WriteLine (o);
49                         
50                 res = e.ToList ();
51                 if (res.Count != 1)
52                         return 10;
53                 
54                 if (res [0].a != "<empty>")
55                         return 11;
56                         
57                 if (res [0].b != "Foo")
58                         return 12;
59                         
60                 var e2 = from a in d1
61                         join a in d2 on a.Key equals a.Key into ab
62                         select a;
63                 
64                 Console.WriteLine ("OK");
65                 return 0;
66         }
67 }
68