Revert "[2018-06] [System]: `MonoTlsStream` is now `IDisposable` and cleans up on...
[mono-project.git] / mono / tests / exception.cs
blobc60e9a3b500f501a926bd0fdf74874ef63065da2
1 using System;
3 public class Ex {
5 int p;
7 public static int test1 () {
8 Ex x = null;
10 try {
11 x.p = 1;
12 } catch (NullReferenceException) {
13 return 0;
15 return 1;
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;
36 return res;
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;
46 return 0;