More tests.
authorMarek Safar <marek.safar@gmail.com>
Tue, 3 Nov 2009 19:01:02 +0000 (19:01 -0000)
committerMarek Safar <marek.safar@gmail.com>
Tue, 3 Nov 2009 19:01:02 +0000 (19:01 -0000)
svn path=/trunk/mcs/; revision=145312

mcs/tests/dtest-003.cs
mcs/tests/dtest-007.cs
mcs/tests/known-issues-dmcs

index 4990121d73a285815cdf6128ceaa5e3582ef7a62..345b57bba70e97b6ecfbe642a5524e054430c96f 100644 (file)
@@ -262,7 +262,7 @@ class Tester : DynamicObjectMock
                        Assert (binder.Operation, ExpressionType.Add, "Operation");
                        AssertArgument (binder, new[] {
                            CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
-                           CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, null)      // CSC bug?
+                           CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null)
                        }, "ArgumentInfo");
 
                        Assert (arg, Enum.A, "arg");
@@ -872,7 +872,7 @@ class Tester : DynamicObjectMock
                        AssertArgument (binder, new[] {
                                CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
                                CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null),
-                               CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.NamedArgument | CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.LiteralConstant, "name")        // CSC bug?
+                               CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.NamedArgument | CSharpArgumentInfoFlags.UseCompileTimeType, "name")
                        }, "ArgumentInfo");
 
                        Assert ((IList<object>) args, new object[] { typeof (bool), -1 }, "args");
@@ -880,7 +880,7 @@ class Tester : DynamicObjectMock
 
                d (typeof (bool), name:-1);
        }
-
+       
        void InvokeMember_1 (dynamic d, DynamicObjectMock mock)
        {
                mock.InvokeMemberOperation = (binder, args) => {
@@ -1033,7 +1033,7 @@ class Tester : DynamicObjectMock
                                CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.None, null),
                                CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null),
                                CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null),
-                               CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.LiteralConstant | CSharpArgumentInfoFlags.UseCompileTimeType, null)
+                               CSharpArgumentInfo.Create (CSharpArgumentInfoFlags.UseCompileTimeType, null)
                        }, "ArgumentInfo");
 
                        Assert ((IList<object>) args, new object[] { 2, 3 }, "args");
index 3745d2c645d9da14cc24aace99c97d124c82efea..b374fc03befb42eaa046b3e225af680faad74db8 100644 (file)
@@ -7,6 +7,7 @@ using Microsoft.CSharp.RuntimeBinder;
 // Dynamic member lookup tests
 
 delegate void D ();
+delegate void D2 (decimal d);
 
 class Class
 {
@@ -15,6 +16,15 @@ class Class
 
        public const decimal Decimal = -0.3m;
 
+       public Class ()
+       {
+       }
+
+       public Class (sbyte extra)
+       {
+               IntValue = extra;
+       }
+
        uint s = 77;
        protected internal uint this[byte i] {
                get {
@@ -46,6 +56,12 @@ class Class
                return value;
        }
 
+       public void MethodInOut (ref int refValue, out string outValue)
+       {
+               refValue = 3;
+               outValue = "4";
+       }
+
        public static void GenericVoid<T> (T i)
        {
        }
@@ -58,9 +74,6 @@ class Class
 
 class Tester
 {
-       delegate void EmptyDelegate ();
-       delegate int IntDelegate ();
-
        static void Assert<T> (T expected, T value, string name)
        {
                if (!EqualityComparer<T>.Default.Equals (expected, value)) {
@@ -108,18 +121,33 @@ class Tester
 
                Action<bool> f2 = Class.GenericVoid;
                d = f2;
-               Assert<object> (null, d (true), "#2");
+               d (true);
        }
 
        void InvokeMember ()
        {
-//             dynamic d = new Class ();
-//             Assert ("vv", d.Method ("vv"), "#1");
+               dynamic d = new Class ();
+               Assert ("vv", d.Method ("vv"), "#1");
+
+               var arg1 = 1;
+               var arg2 = "a";
+               d.MethodInOut (ref arg1, out arg2);
 
-               dynamic d = 2;
+               d = 2;
                Assert (2, Class.StaticMethod (d), "#2");
        }
 
+       void InvokeConstructor ()
+       {
+               dynamic d = (sbyte) 8;
+               var r = new Class (d);
+               Assert (8, r.IntValue, "#1");
+
+               D2 method = (decimal e) => { };
+               d = method;
+               var r2 = new D2 (d);
+       }
+
        void MemberGetTest ()
        {
                dynamic d = new Class ();
index f9a303a101b2c42be535b00a9e9789c4c5b8007b..f16badf107c92e1f24fc3e7cbe453fa2ffac6a2f 100644 (file)
@@ -19,7 +19,6 @@ gtest-variance-8.cs
 gtest-variance-10.cs
 gtest-variance-12.cs
 
-dtest-003.cs
 dtest-004.cs
 
 test-416.cs bug #504085