Author: raja
Date: 2007-07-20 09:22:16 -0400 (Fri, 20 Jul 2007)
New Revision: 82352

Modified:
   trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog
   trunk/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
Log:
* MethodInfoTest.cs (GetGenericMethodDefinition): New.  Based on
Atsushi's testcase in #78068.


Modified: trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog     2007-07-20 
13:21:23 UTC (rev 82351)
+++ trunk/mcs/class/corlib/Test/System.Reflection/ChangeLog     2007-07-20 
13:22:16 UTC (rev 82352)
@@ -1,3 +1,8 @@
+2007-07-20  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * MethodInfoTest.cs (GetGenericMethodDefinition): New.  Based on
+       Atsushi's testcase in #78068.
+
 2007-07-19  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * MethodInfoTest.cs : fix incorrect parameter type output.

Modified: trunk/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs     
2007-07-20 13:21:23 UTC (rev 82351)
+++ trunk/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs     
2007-07-20 13:22:16 UTC (rev 82352)
@@ -444,6 +444,46 @@
                        Assert.IsFalse (m3.IsGenericMethodDefinition);
                }
 
+               [Test]
+               public void GetGenericMethodDefinition ()
+               {
+                       MethodInfo mi1 = typeof (MyList<>).GetMethod 
("ConvertAll");
+                       MethodInfo mi2 = typeof (MyList<int>).GetMethod 
("ConvertAll");
+
+                       Assert.AreEqual 
("MonoTests.System.Reflection.MethodInfoTest+Foo`2[T,TOutput]",
+                                        mi1.GetParameters () 
[0].ParameterType.ToString ());
+                       Assert.AreEqual 
("MonoTests.System.Reflection.MethodInfoTest+Foo`2[System.Int32,TOutput]",
+                                        mi2.GetParameters () 
[0].ParameterType.ToString ());
+                       Assert.IsTrue (mi1.IsGenericMethod);
+                       Assert.IsTrue (mi1.IsGenericMethodDefinition);
+                       Assert.IsTrue (mi2.IsGenericMethod);
+                       Assert.IsTrue (mi2.IsGenericMethodDefinition);
+
+                       MethodInfo mi3 = mi2.GetGenericMethodDefinition ();
+
+                       Assert.IsTrue (mi3.IsGenericMethod);
+                       Assert.IsTrue (mi3.IsGenericMethodDefinition);
+
+                       // ensure it's the same object, not just equal
+                       Assert.IsTrue (mi2 == mi3);
+               }
+
+               public class MyList<T>
+               {
+                       public TOutput ConvertAll<TOutput> (Foo<T,TOutput> arg)
+                       {
+                               return default (TOutput);
+                       }
+                       public T ConvertAll2 (MyList<T> arg)
+                       {
+                               return default (T);
+                       }
+               }
+
+               public class Foo<T,TOutput>
+               {
+               }
+
                class GenericHelper<T>
                {
                        public void Test (T t)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to