[runtime] Remove all NACL support. It was unmaintained for a long time. (#4955)
[mono.git] / mono / tests / generics-invoke-byref.2.cs
index d62aa346a60b010b8fc5f1b78863921446b37e94..26088d7e30d26bddaba324b645eb3a28acd5b1dc 100644 (file)
@@ -5,23 +5,48 @@ namespace TestConsole
 {
     class Program
     {
-        static void Main(string[] args)
+        static int Main(string[] args)
         {
-         List<string> str = null;
+                       List<string> str = null;
          
-         object[] methodArgs = new object[] { str };
+                       object[] methodArgs = new object[] { str };
          
-         Program p = new Program();
-         p.GetType().GetMethod("TestMethod").Invoke(p, methodArgs);
+                       Program p = new Program();
+                       p.GetType().GetMethod("TestMethod").Invoke(p, methodArgs);
+
+                       /* Byref nullable tests */
+                       object[] a = new object [1];
+                       int? i = 5;
+                       object o = i;
+                       a [0] = o;
+                       typeof (Program).GetMethod ("TestMethodNullable").Invoke (p, a);
+                       if ((int)a [0] != 6)
+                               return 1;
+                       if ((int)o != 5)
+                               return 2;
+
+                       a [0] = null;
+                       typeof (Program).GetMethod ("TestMethodNullable").Invoke (p, a);
+                       if ((int)a [0] != 0)
+                               return 3;
+
+                       return 0;
         }
       
-       public Program()
-       {
-       }
+               public Program()
+               {
+               }
 
        public void TestMethod(ref List<string> strArg)
        {
          strArg = new List<string>();
        }
+
+               public void TestMethodNullable (ref int? x) {
+                       if (x != null)
+                               x ++;
+                       else
+                               x = 0;
+               }
     }
 }