2004-03-17 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Wed, 17 Mar 2004 20:42:19 +0000 (20:42 -0000)
committerZoltan Varga <vargaz@gmail.com>
Wed, 17 Mar 2004 20:42:19 +0000 (20:42 -0000)
* exceptions.cs: Add test for exceptions in static constructors.

svn path=/trunk/mono/; revision=24251

mono/mini/ChangeLog
mono/mini/exceptions.cs

index d42cc51804088fd93abde5d7612b8f34bec92bb8..072cbdd311137da3994e594625a1c299a235b6dc 100644 (file)
@@ -1,5 +1,7 @@
 2004-03-17  Zoltan Varga  <vargaz@freemail.hu>
 
+       * exceptions.cs: Add test for exceptions in static constructors.
+
        * mini.c (mono_jit_compile_method_with_out): Move the calling of
        static constructors outside the domain lock. Fixes #55720.
 
index 43b95f2370ec932e00ca88e9e080865dd4120773..6a65274fdc8efa3d8bff9d374fdc5d44996fa8ef 100644 (file)
@@ -1793,5 +1793,43 @@ class Tests {
                
                return 0;
        }
+
+       class Broken {
+               static int i;
+
+               static Broken () {
+                       throw new Exception ("Ugh!");
+               }
+       
+               public static int DoSomething () {
+                       return i;
+               }
+       }
+
+       static int test_0_exception_in_cctor () {
+               try {
+                       Broken.DoSomething ();
+               }
+               catch (TypeInitializationException) {
+                       return 0;
+               }
+               return 1;
+       }
+
+       static int test_5_regalloc () {
+               int i = 0;
+
+               try {
+                       for (i = 0; i < 10; ++i) {
+                               if (i == 5)
+                                       throw new Exception ();
+                       }
+               }
+               catch (Exception ex) {
+                       return i;
+               }
+
+               return i;
+       }
 }