Skip to content

Commit 7cafec9

Browse files
committed
More tests (Better than C# for struct assignation)
1 parent 6d5dd04 commit 7cafec9

File tree

6 files changed

+101
-0
lines changed

6 files changed

+101
-0
lines changed

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorScriptEvaluateTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,20 @@ public static IEnumerable<TestCaseData> TestCasesForScriptEvaluateTests
13491349
.SetCategory("Bug")
13501350
.Returns("Result Hey 9");
13511351

1352+
yield return new TestCaseData(Resources.Script0058,null, null, null)
1353+
.SetCategory("Script")
1354+
.SetCategory("struct tests")
1355+
.SetCategory("Bug")
1356+
.SetCategory("Better Than C#")
1357+
.Returns("Result Hey 9");
1358+
1359+
yield return new TestCaseData(Resources.Script0059,null, null, null)
1360+
.SetCategory("Script")
1361+
.SetCategory("struct tests")
1362+
.SetCategory("Bug")
1363+
.SetCategory("Better Than C#")
1364+
.Returns("Result Hey 9, 5");
1365+
13521366
#endregion
13531367
}
13541368
}

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,13 @@ public static IEnumerable<TestCaseData> TestCasesEvaluateWithSpecificEvaluator
15251525
.SetCategory("Options")
15261526
.SetCategory("Integer Numbers default types");
15271527

1528+
yield return new TestCaseData(evaluatorWithIntForceToDouble
1529+
, "(new string[2]).Length")
1530+
.Returns(2)
1531+
.SetCategory("Bug")
1532+
.SetCategory("Options")
1533+
.SetCategory("Integer Numbers default types");
1534+
15281535
#endregion
15291536
}
15301537
}

CodingSeb.ExpressionEvaluator.Tests/Resources.Designer.cs

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CodingSeb.ExpressionEvaluator.Tests/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,10 @@
289289
<data name="Script0057" type="System.Resources.ResXFileRef, System.Windows.Forms">
290290
<value>resources\script0057.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
291291
</data>
292+
<data name="Script0058" type="System.Resources.ResXFileRef, System.Windows.Forms">
293+
<value>resources\script0058.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
294+
</data>
295+
<data name="Script0059" type="System.Resources.ResXFileRef, System.Windows.Forms">
296+
<value>resources\script0059.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
297+
</data>
292298
</root>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* Script0058 */
2+
classStructContainer = new ClassStructContainer()
3+
{
4+
NestedStructProperty = new StructForTest1()
5+
{
6+
myIntvalue = 8,
7+
myStringValue = "Hey"
8+
}
9+
};
10+
11+
// Do not compile
12+
classStructContainer.NestedStructProperty.myIntvalue = 9;
13+
14+
return $"Result {classStructContainer.NestedStructProperty.myStringValue} {classStructContainer.NestedStructProperty.myIntvalue}";
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* Script0059 */
2+
otherStruct = new StructForTest4();
3+
4+
otherStruct.AnOtherIntValue = 5;
5+
otherStruct.NestedStruct = new StructForTest3()
6+
{
7+
MyIntvalue = 8,
8+
MyStringValue = "Hey"
9+
};
10+
11+
// Do not compile
12+
otherStruct.NestedStruct.MyIntvalue = 9;
13+
14+
return $"Result {otherStruct.NestedStruct.MyStringValue} {otherStruct.NestedStruct.MyIntvalue}, {otherStruct.AnOtherIntValue}";

0 commit comments

Comments
 (0)