Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / exception16.cs
1 using System;
2
3 public class TestTryFinally 
4 {
5         static int result = 0;
6         
7         public static void TrivialMain() 
8         {
9                 int i = 123;
10                 string s = "Some string";
11                 object o = s;
12
13                 try {
14                         // Illegal conversion; o contains a string not an int
15                         i = (int) o;   
16                 }
17                 finally {
18                         Console.WriteLine("i = {0}", i);
19                         result = i;
20                 }
21         }
22
23         public static int Main() 
24         {
25                 try {
26                         try {
27                                 TrivialMain();
28                         }
29                         finally {
30                                 Console.WriteLine("cleaning up");
31                         }
32                 }
33                 catch(Exception) {
34                         Console.WriteLine("catch expected exception");
35                         result += 1;
36                 }
37
38                 if (result != 124)
39                         return 1;
40
41                 return 0;
42         }
43 }
44