flush
[mcs.git] / ilasm / tests / test-seh-b.il
blobf667399e9bc612257cb7e5e54253d455d3508c6f
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 //
10 .assembly extern mscorlib { }
11 .assembly extern System { }
12 .assembly 'test-seh-b' { }
15 .class public T {
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
25                 ldc.i4.0
26                 stsfld int32 T::flt_caught
28                 ret
29         }
31         .method public static int32 Main ()
32         {
33                 .entrypoint
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            
52         outer:
53                 ldsfld int32 T::exc_caught
54                 brfalse fail
56                 ldsfld int32 T::flt_caught
57                 brfalse fail
59         pass:
60                 ldstr "PASS"
61                 call void [mscorlib]System.Console::WriteLine (string)
62                 ldc.i4.0
63                 ret
65         fail:
66                 ldstr "FAIL"
67                 call void [mscorlib]System.Console::WriteLine (string)
68                 ldc.i4.1
69                 ret
71         }
74