Add [Category ("NotWorking")] to failing test.
[mono.git] / mcs / tests / test-async-22.cs
1 using System;
2 using System.Threading.Tasks;
3
4 // contextual async, parser tests
5 class A : Iasync
6 {
7         async Task<int> async ()
8         {
9                 int async;
10                 throw new NotImplementedException ();
11         }
12
13         async Task async (int async)
14         {
15                 throw new NotImplementedException ();
16         }
17         
18         async void CastTest ()
19         {
20                 var res = (int) await async ();
21                 var res2 = (Int32) await async ();
22         }
23         
24         async void Iasync.async ()
25         {
26         }
27
28         public static int Main ()
29         {
30                 return 0;
31         }
32 }
33
34 interface Iasync
35 {
36         void async ();
37 }
38
39 class B
40 {
41         class async
42         {
43                 async (async arg)
44                 {
45                 }
46         }
47 }
48
49 class C
50 {
51         static void Test (bool async)
52         {
53                 var a = async ? Prop : 2;
54         }
55
56         static int Prop {
57                 get {
58                         return 3;
59                 }
60         }
61 }
62
63 class async
64 {
65         async (async arg)
66         {
67                 int await = 0;
68         }
69 }
70
71 class await
72 {
73         await (await arg)
74         {
75         }
76 }
77
78 [async]
79 class asyncAttribute: Attribute
80 {
81         delegate async async (async async);
82 }
83
84 namespace AsyncNS
85 {
86         class Classes
87         {
88                 class async
89                 {
90                 }
91                 
92                 void M ()
93                 {
94                         async local;
95                 }
96         }
97
98         namespace Namespaces
99         {
100                 namespace async { }
101         }
102 }
103
104 namespace AwaitNS
105 {
106         class Formals
107         {
108                 delegate void D (int x);
109                 static void M1 ()
110                 {
111                         D d1 = await => { };
112                         D d2 = (int await) => { };
113                         D d3 = delegate (int await) { };
114                 }
115         }
116
117         class Methods
118         {
119                 void await () { }
120                 void M (Methods m)
121                 {
122                         m.await ();
123                         this.await ();
124                         // FIXME: await ();
125                 }
126         }
127
128         class Classes
129         {
130                 class await { }
131                 void M ()
132                 {
133                         // FIXME: @await local = new @await ();
134                 }
135         }
136
137         class AnonTypes
138         {
139                 static void M ()
140                 {
141                         var x = new { await = 1 };
142                         var y = x.await;
143                         int await = 2;
144                         var x2 = new { await };
145                 }
146         }
147
148         class Initializer
149         {
150                 int await;
151
152                 static void M ()
153                 {
154                         var a = new Initializer () {
155                                 await = 2
156                         };
157                 }
158         }
159 }