File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
CodingSeb.ExpressionEvaluator.Tests
CodingSeb.ExpressionEvaluator Expand file tree Collapse file tree 3 files changed +18
-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 2626 <PackageLicenseFile >LICENSE.md</PackageLicenseFile >
2727 <RepositoryUrl >https://github.com/codingseb/ExpressionEvaluator</RepositoryUrl >
2828 <GenerateDocumentationFile >true</GenerateDocumentationFile >
29+ <PackageReadmeFile >README.md</PackageReadmeFile >
2930 </PropertyGroup >
3031 <PropertyGroup Condition =" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " >
3132 <DebugType >full</DebugType >
5354 <Pack >True</Pack >
5455 <PackagePath ></PackagePath >
5556 </None >
57+ <None Include =" ..\README.md" >
58+ <Pack >True</Pack >
59+ <PackagePath >\</PackagePath >
60+ </None >
5661 </ItemGroup >
5762</Project >
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