Skip to content

Commit f927135

Browse files
committed
Add tests for modern dynamic LINQ syntax
1 parent 9741013 commit f927135

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Bonsai.Scripting.Expressions.Tests/ExpressionScriptingTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ async Task AssertExpressionTransform<TSource, TResult>(string expression, TSourc
3131
[DataRow("Math.PI", 42, Math.PI)]
3232
[DataRow("Convert.ToInt16(it)", 42, (short)42)]
3333
[DataRow("new(it as Data).Data", 42, 42)]
34+
// modern Dynamic LINQ parser
35+
[DataRow("float(it)", 42, 42f)]
36+
[DataRow("long?(it).HasValue", 42, true)]
37+
[DataRow("bool.TrueString", 42, "True")]
38+
[DataRow("new[] { it }", 42, new[] { 42 })]
39+
[DataRow("new[] { it }.Select(x => x * 2).ToArray()", 21, new[] { 42 })]
40+
[DataRow("np(string(null).Length) ?? it", 42, 42)]
3441
public Task TestExpressionTransform<TSource, TResult>(string expression, TSource value, TResult expected)
3542
{
3643
return AssertExpressionTransform(expression, value, expected);

0 commit comments

Comments
 (0)