New tests.
authorMarek Safar <marek.safar@gmail.com>
Fri, 11 Sep 2009 17:13:04 +0000 (17:13 -0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 11 Sep 2009 17:13:04 +0000 (17:13 -0000)
svn path=/trunk/mcs/; revision=141782

mcs/tests/dtest-004.cs [new file with mode: 0644]
mcs/tests/dtest-005.cs [new file with mode: 0644]
mcs/tests/known-issues-dmcs

diff --git a/mcs/tests/dtest-004.cs b/mcs/tests/dtest-004.cs
new file mode 100644 (file)
index 0000000..52e858d
--- /dev/null
@@ -0,0 +1,13 @@
+class C
+{
+       public static dynamic Create ()
+       {
+               return 1;
+       }
+       
+       public static void Main ()
+       {
+               var d = Create ();
+               d.Foo ();
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/dtest-005.cs b/mcs/tests/dtest-005.cs
new file mode 100644 (file)
index 0000000..d6156bb
--- /dev/null
@@ -0,0 +1,42 @@
+using System;
+using System.Dynamic;
+
+public class MyObject : DynamicObject
+{
+       public static int Get, Invoke;
+
+       public override bool TryGetMember (GetMemberBinder binder, out object result)
+       {
+               Console.WriteLine ("Get");
+               Get++;
+               result = null;
+               return true;
+       }
+
+       public override bool TryInvokeMember (InvokeMemberBinder binder, object[] args, out object result)
+       {
+               Console.WriteLine ("Invoke");
+               Invoke++;
+               result = null;
+               return true;
+       }
+}
+
+public class Tests
+{
+       public static int Main ()
+       {
+               dynamic d = new MyObject ();
+
+               var g = d.GetMe;
+               if (MyObject.Get != 1 && MyObject.Invoke != 0)
+                       return 1;
+
+               d.printf ("Hello, World!");
+               if (MyObject.Get != 1 && MyObject.Invoke != 1)
+                       return 2;
+
+               Console.WriteLine ("ok");
+               return 0;
+       }
+}
index cb882007483ed030447814ed253c603262c642ca..0d4dc53271fb65469c640da35e0e148c78508ae7 100644 (file)
@@ -20,6 +20,8 @@ gtest-variance-8.cs
 gtest-variance-10.cs
 gtest-variance-12.cs
 
+dtest-004.cs
+
 test-416.cs bug #504085
 test-418.cs bug #504085
 test-682.cs bug #530861