[mono/tests] Fix out of tree build.
[mono-project.git] / mcs / tests / test-async-31.cs
blobbbff8e3115c0ef1b6c9c1fba2570650bb2add5f6
1 using System;
2 using System.Collections.Generic;
3 using System.Threading.Tasks;
5 class C
7 async Task<int> M(int v)
10 await Task.Yield();
11 int vv = 0;
12 Func<int> a = () => vv;
13 vv = 3;
14 Func<int> a2 = () => v + vv;
15 if (a() != vv)
16 return 1;
18 if (a2() != 58)
19 return 2;
21 return 0;
24 async Task<int> M2(int v, int o)
26 await Task.Yield();
27 var xo = await Task.FromResult(v);
28 int vv = v;
29 Action a2;
30 int b = o;
32 a2 = () => {
33 v = 500;
34 b = 2;
38 await Task.Yield();
39 a2 ();
40 if (v != 500)
41 return 1;
43 return 0;
46 public static int Main()
48 var c = new C();
49 if (c.M(55).Result != 0)
50 return 1;
52 if (c.M2(55, 22).Result != 0)
53 return 2;
55 return 0;