2010-06-17 Geoff Norton <gnorton@novell.com>
[mono.git] / mono / tests / exception16.cs
blob87e45da4e4febd487171ec52d0b0fd8cc87ce8bf
1 using System;
3 public class TestTryFinally
5 static int result = 0;
7 public static void TrivialMain()
9 int i = 123;
10 string s = "Some string";
11 object o = s;
13 try {
14 // Illegal conversion; o contains a string not an int
15 i = (int) o;
17 finally {
18 Console.WriteLine("i = {0}", i);
19 result = i;
23 public static int Main()
25 try {
26 try {
27 TrivialMain();
29 finally {
30 Console.WriteLine("cleaning up");
33 catch(Exception) {
34 Console.WriteLine("catch expected exception");
35 result += 1;
38 if (result != 124)
39 return 1;
41 return 0;