Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / exception.cs
1 using System;
2
3 public class Ex {
4
5         int p;
6         
7         public static int test1 () {
8                 Ex x = null;
9                 
10                 try {
11                         x.p = 1;
12                 } catch (NullReferenceException) {
13                         return 0;
14                 }
15                 return 1;
16         }
17         
18         public static int test (int a) {
19                 int res;
20                 int fin = 0;
21                 try {
22                         res = 10/a;
23                 } catch (DivideByZeroException ex) {
24                         if (fin != 1)
25                                 res = 34;
26                         else
27                                 res = 33;
28                 } catch {
29                         if (fin != 1)
30                                 res = 24;
31                         else
32                                 res = 22;
33                 } finally {
34                         fin = 1;
35                 }
36                 return res;
37         }
38         public static int Main () {
39                 if (test(1) != 10)
40                         return 1;
41                 if (test(0) != 34)
42                         return 2;
43                 if (test1() != 0)
44                         return 3;
45                 
46                 return 0;
47         }
48 }
49
50