瀏覽代碼

new test

svn path=/trunk/mcs/; revision=103176
Jb Evain 17 年之前
父節點
當前提交
0d45c09dee

+ 1 - 1
mcs/class/System.Core/Test/System.Linq.Expressions/ChangeLog

@@ -1,5 +1,5 @@
 2008-05-13  Roei Erez  <[email protected]>
-	
+
 	* ExpressionTest.cs: Exclude tests only in JAVAEE environment.
 
 2008-03-05  Jb Evain  <[email protected]>

+ 20 - 0
mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Lambda.cs

@@ -187,5 +187,25 @@ namespace MonoTests.System.Linq.Expressions
 
 			Assert.AreEqual (typeof (Expression<Func<string>>), l.GetType ());
 		}
+
+		public static int CallDelegate (Func<int, int> e)
+		{
+			return e (42);
+		}
+
+		[Test]
+		[Category ("NotWorking")]
+		public void LambdaPassedAsDelegate ()
+		{
+			var pi = Expression.Parameter (typeof (int), "i");
+			var identity = Expression.Lambda<Func<int, int>> (pi, pi);
+
+			var l = Expression.Lambda<Func<int>> (
+				Expression.Call (
+					GetType ().GetMethod ("CallDelegate"),
+					identity)).Compile ();
+
+			Assert.AreEqual (42, l ());
+		}
 	}
 }