Author: jbevain
Date: 2007-09-11 16:52:16 -0400 (Tue, 11 Sep 2007)
New Revision: 85661

Modified:
   trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
   trunk/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs
Log:
2007-09-11  Jb Evain  <[EMAIL PROTECTED]>

        * DynamicMethodTest.cs: add test for owner member access.


Modified: trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog        
2007-09-11 20:51:10 UTC (rev 85660)
+++ trunk/mcs/class/corlib/Test/System.Reflection.Emit/ChangeLog        
2007-09-11 20:52:16 UTC (rev 85661)
@@ -1,3 +1,7 @@
+2007-09-11  Jb Evain  <[EMAIL PROTECTED]>
+
+       * DynamicMethodTest.cs: add test for owner member access.
+
 2007-09-11  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * MethodBuilderTest.cs: Add new tests for using generic types in the IL

Modified: 
trunk/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs
===================================================================
--- trunk/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs     
2007-09-11 20:51:10 UTC (rev 85660)
+++ trunk/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs     
2007-09-11 20:52:16 UTC (rev 85661)
@@ -292,6 +292,25 @@
 
                        m1.Invoke(null, new object[] { 5 });
                }
+
+               class Host {
+                       static string Field = "foo";
+               }
+
+               [Test]
+               public void TestOwnerMemberAccess ()
+               {
+                       DynamicMethod method = new DynamicMethod ("GetField",
+                               typeof (string), new Type [0], typeof (Host));
+
+                       ILGenerator il = method.GetILGenerator ();
+                       il.Emit (OpCodes.Ldsfld, typeof (Host).GetField (
+                               "Field", BindingFlags.Static | 
BindingFlags.NonPublic));
+                       il.Emit (OpCodes.Ret);
+
+                       string ret = (string) method.Invoke (null, new object 
[] {});
+                       Assert.AreEqual ("foo", ret, "#1");
+               }
        }
 }
 

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

Reply via email to