2007-01-15 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Mon, 15 Jan 2007 18:36:38 +0000 (18:36 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Mon, 15 Jan 2007 18:36:38 +0000 (18:36 -0000)
* load-missing.il: Add test for missing assembly reference in
field reference;

Add test for missing type in newobj call.

Add test for missing type reference in a parameter.

Add test for missing assembly in method call.

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

mono/tests/ChangeLog
mono/tests/load-exceptions.cs
mono/tests/load-missing.il

index e91339cfcfbdc3cae7d604bc1b36f0e7488340a8..c308393022de5572c6eea79706760c7af939bba9 100644 (file)
@@ -1,3 +1,14 @@
+2007-01-15  Miguel de Icaza  <miguel@novell.com>
+
+       * load-missing.il: Add test for missing assembly reference in
+       field reference;
+
+       Add test for missing type in newobj call.
+
+       Add test for missing type reference in a parameter.
+
+       Add test for missing assembly in method call.
+
 2007-01-11  Jonathan Chambers  <joncham@gmail.com>
 
        * libtest.c, cominterop.cs: Tests for unmanaged->managed
index b84c7b4eb7d2f7370d252837dbb6083f1c4f3ea7..c9480634171e67c0387b3e2bce289c0cb17ab406 100644 (file)
@@ -3,6 +3,7 @@
 //
 
 using System;
+using System.IO;
 
 class Miss1 : Missing.Foo1 {
 }
@@ -36,6 +37,15 @@ public class Tests : LoadMissing {
                return 1;
        }
 
+       internal static int check_file_not_found (TestDel d){
+               try {
+                       d ();
+               } catch (FileNotFoundException ex){
+                       return 0;
+               }
+               return 1;
+       }
+       
        internal static int check_missing_field (TestDel d) {
                try {
                        d ();
@@ -48,6 +58,7 @@ public class Tests : LoadMissing {
                return 1;
        }
 
+
        //
        // Base instructions
        //
@@ -85,6 +96,9 @@ public class Tests : LoadMissing {
                return check_type_load (new TestDel (missing_cpobj));
        }
 
+        public static int test_0_missing_type_on_parameter () {
+               return check_type_load (new TestDel (missing_external_type_reference_on_parameter));
+        } 
        public static int test_0_initobj () {
                return check_type_load (new TestDel (missing_initobj));
        }
@@ -187,6 +201,21 @@ public class Tests : LoadMissing {
                return check_type_load (new TestDel (missing_unbox_any));
        }
 
+#if false
+       // Bummer: we regressed!   I should have put this before
+       public static int test_0_missing_assembly_in_fieldref () {
+               return check_file_not_found (new TestDel (missing_assembly_in_fieldref));
+       }
+#endif
+
+       public static int test_0_missing_assembly_in_call () {
+               return check_missing_method (new TestDel (missing_assembly_in_call));
+       }
+
+       public static int test_0_missing_assembly_in_newobj () {
+               return check_missing_method (new TestDel (missing_assembly_in_newobj));
+       }
+       
        //
        // Missing classes referenced from metadata
        //
index a505a856091294e969b547021aab92c096b9b738..a8553f98648af58943599d32f7ece149af6d9a7d 100644 (file)
     IL_0011:  ret\r
   }\r
 \r
+  .method public hidebysig static void missing_assembly_in_fieldref () cil managed\r
+  {\r
+        .maxstack 8\r
+        ldc.i4.0\r
+        stsfld  int32 [t]X::a\r
+        ret\r
+  }\r
+\r
+  .method public hidebysig static void missing_assembly_in_call () cil managed\r
+  {\r
+        .maxstack 8\r
+        call void class [t]Gtk.Application::Init()\r
+        ret\r
+  }\r
+\r
+  .method public hidebysig static void missing_assembly_in_newobj () cil managed\r
+  {\r
+        .maxstack 8\r
+       newobj instance void class [mscorlib]System.Dingus::.ctor()\r
+       pop\r
+       ret\r
+  }\r
+\r
+  .method public hidebysig static void missing_external_type_reference_on_parameter() cil managed\r
+  {\r
+    .maxstack 8\r
+    ldstr "Hello"\r
+    call void class [mscorlib]System.String::Trim([mscorlib]MissingType)\r
+    ret\r
+  }\r
+\r
   .method public hidebysig static void  missing_ldtoken_field() cil managed\r
   {\r
    \r