2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / mcs / ilasm / tests / test-seh-b.il
1 //
2 // Test catch and fault blocks
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
9
10 .assembly extern mscorlib { }
11 .assembly extern System { }
12 .assembly 'test-seh-b' { }
13
14
15 .class public T {
16
17         .field private static int32 exc_caught
18         .field private static int32 flt_caught
19   
20         .method public static specialname void .cctor ()
21         {
22                 ldc.i4.0
23                 stsfld int32 T::exc_caught
24
25                 ldc.i4.0
26                 stsfld int32 T::flt_caught
27
28                 ret
29         }
30
31         .method public static int32 Main ()
32         {
33                 .entrypoint
34
35                 .try {
36                         .try {
37                                 ldstr "#jibba!!jabba"
38                                 newobj void [System]System.Uri::.ctor (string)
39                                 leave outer
40                         } catch [mscorlib]System.Exception {
41                                 ldc.i4.1
42                                 stsfld int32 T::exc_caught
43                                 leave outer
44                         }
45                 } fault {
46                         ldc.i4.1
47                         stsfld int32 T::flt_caught
48                         endfault
49                  }
50            
51
52         outer:
53                 ldsfld int32 T::exc_caught
54                 brfalse fail
55
56                 ldsfld int32 T::flt_caught
57                 brfalse fail
58
59         pass:
60                 ldstr "PASS"
61                 call void [mscorlib]System.Console::WriteLine (string)
62                 ldc.i4.0
63                 ret
64
65         fail:
66                 ldstr "FAIL"
67                 call void [mscorlib]System.Console::WriteLine (string)
68                 ldc.i4.1
69                 ret
70
71         }
72
73 }
74                 
75