New test.
[mono.git] / mono / tests / exception3.cs
1 using System;
2
3 public class MyEx : Exception {
4         public MyEx () {}
5 }
6
7 public class Ex {
8
9         static int fin;
10
11         public static int test (int a) {
12                 int res;
13
14                 fin = 0;
15
16                 try {
17                         try {
18                                 res = 10/a;
19                                 throw new MyEx ();
20                         } catch (DivideByZeroException ex) {
21                                 if (fin != 1)
22                                         res = 34;
23                                 else
24                                         res = 33;
25                         } finally {
26                                 fin = 1;
27                         }
28                 } finally {
29                         fin += 1;
30                 }
31                 
32                 return res;
33         }
34         public static int Main () {
35                 int catched = 0;
36                 try {
37                         test (1);
38                 } catch (MyEx ex) {
39                         catched = 1;
40                 }
41                 if (catched != 1)
42                         return 2;
43
44                 if (fin != 2)
45                         return 3;
46                 
47                 if (test(0) != 34)
48                         return 4;
49                 return 0;
50         }
51 }
52
53