From ffbf5538c55a3bf40ec949dfbb2a020527e59c59 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 11 Sep 2009 17:13:04 +0000 Subject: [PATCH] New tests. svn path=/trunk/mcs/; revision=141782 --- mcs/tests/dtest-004.cs | 13 ++++++++++++ mcs/tests/dtest-005.cs | 42 +++++++++++++++++++++++++++++++++++++ mcs/tests/known-issues-dmcs | 2 ++ 3 files changed, 57 insertions(+) create mode 100644 mcs/tests/dtest-004.cs create mode 100644 mcs/tests/dtest-005.cs diff --git a/mcs/tests/dtest-004.cs b/mcs/tests/dtest-004.cs new file mode 100644 index 00000000000..52e858d0ec8 --- /dev/null +++ b/mcs/tests/dtest-004.cs @@ -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 index 00000000000..d6156bb1811 --- /dev/null +++ b/mcs/tests/dtest-005.cs @@ -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; + } +} diff --git a/mcs/tests/known-issues-dmcs b/mcs/tests/known-issues-dmcs index cb882007483..0d4dc53271f 100644 --- a/mcs/tests/known-issues-dmcs +++ b/mcs/tests/known-issues-dmcs @@ -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 -- 2.25.1