[w32file] Move MonoIO.Find{First,Next,Close} to managed
[mono.git] / mcs / tests / test-ex-filter-05.cs
1 using System;
2 using System.Threading.Tasks;
3
4 class Test
5 {
6         static bool Verify (Func<bool> f)
7         {
8                 return f ();
9         }
10
11         static async Task<int> TestCapturedException (Exception e)
12         {
13                 try {
14                         if (e != null)
15                                 throw e;
16                 } catch (Exception ex) when (Verify (() => ex.Message == "foo")) {
17                         await Task.Yield ();
18                         Console.WriteLine (ex);
19                         return 1;
20                 } catch (Exception ex) when (Verify (() => ex.Message != null)) {
21                         await Task.Yield ();
22                         Console.WriteLine (ex);
23                         return 2;
24                 }
25
26                 return 3;
27         }
28
29         public static int Main()
30         {
31                 if (TestCapturedException (null).Result != 3)
32                         return 1;
33
34                 var ex = new ApplicationException ();
35                 if (TestCapturedException (ex).Result != 2)
36                         return 2;
37
38                 return 0;
39         }
40 }