File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
CodingSeb.ExpressionEvaluator.Tests
CodingSeb.ExpressionEvaluator Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1- using Newtonsoft . Json ;
1+ using Microsoft . CSharp . RuntimeBinder ;
2+ using Newtonsoft . Json ;
23using NUnit . Framework ;
34using Shouldly ;
45using System ;
@@ -1837,6 +1838,15 @@ public void Evaluate_DoubleDoubleQuotesInEscapedStringThrowException()
18371838
18381839 evaluator . Evaluate ( "@\" Hello \" \" Joe\" " ) . ShouldBe ( @"Hello "" Joe" ) ;
18391840 }
1841+
1842+ [ Test ]
1843+ [ Category ( "Bug" ) ]
1844+ public void Evaluate_NullAdditionShouldThrowExceptionNotReturnString ( )
1845+ {
1846+ var evaluator = new ExpressionEvaluator ( ) ;
1847+
1848+ Should . Throw < RuntimeBinderException > ( ( ) => evaluator . Evaluate ( "(null + null) + null" ) ) ;
1849+ }
18401850
18411851 //[Test]
18421852 //[Category("Bug")]
Original file line number Diff line number Diff line change @@ -3296,11 +3296,11 @@ void EvaluateFirstPreviousUnaryOp(int j)
32963296 {
32973297 list [ i ] = operatorEvalutationsDict [ eOp ] ( left , right ) ;
32983298
3299- if ( left is BubbleExceptionContainer && right is string )
3299+ if ( left is BubbleExceptionContainer && right is string or null )
33003300 {
33013301 list [ i ] = left ; //Bubble up the causing error
33023302 }
3303- else if ( right is BubbleExceptionContainer && left is string )
3303+ else if ( right is BubbleExceptionContainer && left is string or null )
33043304 {
33053305 list [ i ] = right ; //Bubble up the causing error
33063306 }
You can’t perform that action at this time.
0 commit comments