Author: zoltan
Date: 2007-11-13 14:39:16 -0500 (Tue, 13 Nov 2007)
New Revision: 89576
Modified:
trunk/mcs/class/corlib/Test/System/ChangeLog
trunk/mcs/class/corlib/Test/System/DelegateTest.cs
Log:
2007-11-13 Zoltan Varga <[EMAIL PROTECTED]>
* DelegateTest.cs: Add tests for virtual target methods.
Modified: trunk/mcs/class/corlib/Test/System/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System/ChangeLog 2007-11-13 19:28:27 UTC
(rev 89575)
+++ trunk/mcs/class/corlib/Test/System/ChangeLog 2007-11-13 19:39:16 UTC
(rev 89576)
@@ -1,3 +1,7 @@
+2007-11-13 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * DelegateTest.cs: Add tests for virtual target methods.
+
2007-11-12 Zoltan Varga <[EMAIL PROTECTED]>
* DelegateTest.cs: Add tests for abstract target methods.
Modified: trunk/mcs/class/corlib/Test/System/DelegateTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System/DelegateTest.cs 2007-11-13 19:28:27 UTC
(rev 89575)
+++ trunk/mcs/class/corlib/Test/System/DelegateTest.cs 2007-11-13 19:39:16 UTC
(rev 89576)
@@ -249,7 +249,7 @@
}
[Test]
- public void Abstract ()
+ public void Virtual ()
{
// Delegate with abstract method, no target
FooDelegate del = (FooDelegate)Delegate.CreateDelegate
(typeof (FooDelegate), typeof (Iface).GetMethod ("retarg"));
@@ -262,16 +262,29 @@
FooDelegate del4 = (FooDelegate)Delegate.Combine (del2,
del3);
Assert.AreEqual ("Hello2", del4 (c, "Hello"));
+
+ // Delegate with virtual method, no target
+ FooDelegate2 del5 =
(FooDelegate2)Delegate.CreateDelegate (typeof (FooDelegate2), typeof
(B).GetMethod ("retarg3"));
+ Assert.AreEqual ("Hello2", del5 (c, "Hello"));
}
#endif
delegate string FooDelegate (Iface iface, string s);
+ delegate string FooDelegate2 (B b, string s);
+
public interface Iface
{
string retarg (string s);
}
- public class C : Iface
+ public class B {
+
+ public virtual string retarg3 (string s) {
+ return s;
+ }
+ }
+
+ public class C : B, Iface
{
public string retarg (string s) {
return s;
@@ -281,6 +294,10 @@
return s + "2";
}
+ public override string retarg3 (string s) {
+ return s + "2";
+ }
+
public void M ()
{
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches