2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / exception3.cs
blobdfabf778948234270a11d375703994adb57cdf4b
1 using System;
3 public class MyEx : Exception {
4 public MyEx () {}
7 public class Ex {
9 static int fin;
11 public static int test (int a) {
12 int res;
14 fin = 0;
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;
28 } finally {
29 fin += 1;
32 return res;
34 public static int Main () {
35 int catched = 0;
36 try {
37 test (1);
38 } catch (MyEx ex) {
39 catched = 1;
41 if (catched != 1)
42 return 2;
44 if (fin != 2)
45 return 3;
47 if (test(0) != 34)
48 return 4;
49 return 0;