diff options
author | Haruka Matsumoto <harukam0416@gmail.com> | 2017-08-23 14:00:58 +0300 |
---|---|---|
committer | Haruka Matsumoto <harukam0416@gmail.com> | 2018-01-24 06:35:16 +0300 |
commit | 1202e7430825f35657421366e22cd2f4164a8601 (patch) | |
tree | 30c960adee2d7315382efa62f7f47e4ba3fe16f2 /UnitTests/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs | |
parent | e4631d261e44a2c72eba763e4beb1f2fd7cd55ec (diff) |
Support lambda expressions as method parameters
on Immediate Pad.
- Not access to local variables nor methods defined in user code
For example, `intlst.Max(a => -a)`, `intlst.Any(x => x < 0)` can be evaluated.
Diffstat (limited to 'UnitTests/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs')
-rw-r--r-- | UnitTests/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/UnitTests/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs b/UnitTests/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs index 9ccfd05..172d758 100644 --- a/UnitTests/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs +++ b/UnitTests/MonoDevelop.Debugger.Tests.TestApp/TestEvaluation.cs @@ -189,6 +189,16 @@ namespace MonoDevelop.Debugger.Tests.TestApp return "6"; } } + + public override int OverridenInvokeFuncInt (Func<int> f) + { + return f () + 1; + } + + public override string OverridenInvokeFuncString (Func<string> f) + { + return f () + "-in-overriden"; + } } public abstract class BaseClass @@ -387,6 +397,36 @@ namespace MonoDevelop.Debugger.Tests.TestApp return a.ToString (); } + public int InvokeFuncInt (Func<int> f) + { + return f (); + } + + public string InvokeFuncString (Func<string> f) + { + return f (); + } + + public bool InvokePredicateString (Predicate<string> f) + { + return f ("abc"); + } + + public int InvokeUserDelegate (del f) + { + return f (5, 1); + } + + public int OverloadedInvokeFunc (Func<int> f) + { + return f (); + } + + public string OverloadedInvokeFunc (Func<string> f) + { + return f (); + } + public string EscapedStrings { get { return " \" \\ \a \b \f \v \n \r \t"; } } @@ -407,6 +447,11 @@ namespace MonoDevelop.Debugger.Tests.TestApp return list; } + public static T InvokeGenericFunc<T> (T value, Func<T, T> f) + { + return f (value); + } + class NestedClass { public class DoubleNestedClass @@ -452,6 +497,16 @@ namespace MonoDevelop.Debugger.Tests.TestApp return "5"; } } + + public virtual int OverridenInvokeFuncInt (Func<int> f) + { + return f (); + } + + public virtual string OverridenInvokeFuncString (Func<string> f) + { + return f (); + } } public class SomeClassInNamespace |