2008-06-16 Mark Probst <mark.probst@gmail.com>
authorMark Probst <mark.probst@gmail.com>
Mon, 16 Jun 2008 09:25:24 +0000 (09:25 -0000)
committerMark Probst <mark.probst@gmail.com>
Mon, 16 Jun 2008 09:25:24 +0000 (09:25 -0000)
* generic-virtual.2.cs: Delegate test for static generic methods.

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

mono/tests/ChangeLog
mono/tests/generic-virtual.2.cs

index 95c914f922280fdf05f17a4b244ebda3aad0c7ce..de0548a13805042ff563cf058eb1cff945f06399 100644 (file)
@@ -1,3 +1,7 @@
+2008-06-16  Mark Probst  <mark.probst@gmail.com>
+
+       * generic-virtual.2.cs: Delegate test for static generic methods.
+
 2008-06-14  Kornél Pál  <kornelpal@gmail.com>
 
        * mixed-mode: Add x64 target to mixed-mode assembly tests.
index d20c72ba650855b95974ce494a83c350e068ff95..257d39b416832b0e344af601077d5dda6bc680d1 100644 (file)
@@ -3,6 +3,8 @@ using System;
 public class ClassA {}
 public class ClassB {}
 
+public delegate string[] StringArrayDelegate ();
+
 public class Gen<T> {
        static bool checkArr<S> (Array arr, int length) {
                if (arr.GetType () != typeof (S[]))
@@ -43,6 +45,10 @@ public class GenSubSub : GenSub<ClassA> {
        public override S[] newArr<S> () {
                return new S[5];
        }
+
+       public static S[] staticNewArr<S> () {
+               return new S[5];
+       }
 }
 
 public class main {
@@ -57,6 +63,21 @@ public class main {
                        return 1;
                if (!gss.test ())
                        return 1;
+
+               StringArrayDelegate sad = new StringArrayDelegate (GenSubSub.staticNewArr<string>);
+               string[] arr = sad ();
+               if (arr.GetType () != typeof (string[]))
+                       return 1;
+               if (arr.Length != 5)
+                       return 1;
+
+               sad = new StringArrayDelegate (gss.newArr<string>);
+               arr = sad ();
+               if (arr.GetType () != typeof (string[]))
+                       return 1;
+               if (arr.Length != 5)
+                       return 1;
+
                return 0;
        }
 }