Skip to content

Commit d1cfea9

Browse files
committed
Still some bugs with structs
1 parent 4ec84ce commit d1cfea9

File tree

8 files changed

+77
-8
lines changed

8 files changed

+77
-8
lines changed

CodingSeb.ExpressionEvaluator.Tests/CodingSeb.ExpressionEvaluator.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<Compile Update="TestsUtils\StructForTest1.cs">
2222
<SubType>Code</SubType>
2323
</Compile>
24+
<Compile Update="TestsUtils\StructForTest2.cs">
25+
<SubType>Code</SubType>
26+
</Compile>
2427
</ItemGroup>
2528
<ItemGroup>
2629
<ProjectReference Include="..\CodingSeb.ExpressionEvaluator\CodingSeb.ExpressionEvaluator.csproj" />

CodingSeb.ExpressionEvaluator.Tests/ExpressionEvaluatorScriptEvaluateTests.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,16 +1319,23 @@ public static IEnumerable<TestCaseData> TestCasesForScriptEvaluateTests
13191319

13201320
yield return new TestCaseData("return myStruct.myIntvalue;", evaluatorForStructs, null, null)
13211321
.SetCategory("Script")
1322-
.SetCategory("struct value")
1322+
.SetCategory("struct tests")
13231323
.SetCategory("Bug")
13241324
.Returns(0);
13251325

1326-
yield return new TestCaseData("myStruct.myIntvalue = 3;\r\nmyStruct.myStringValue = \"Test\";"
1327-
, new ExpressionEvaluator(new Dictionary<string, object> { { "myStruct", new StructForTest1() } }), null, null)
1326+
yield return new TestCaseData(Resources.Script0054, evaluatorForStructs, null, null)
13281327
.SetCategory("Script")
1329-
.SetCategory("struct value assignation")
1328+
.SetCategory("struct tests")
13301329
.SetCategory("Bug")
1331-
.Returns(0);
1330+
.Returns("Result Test 3");
1331+
1332+
evaluatorForStructs.Variables["otherStruct"] = new StructForTest2();
1333+
1334+
yield return new TestCaseData(Resources.Script0055, evaluatorForStructs, null, null)
1335+
.SetCategory("Script")
1336+
.SetCategory("struct tests")
1337+
.SetCategory("Bug")
1338+
.Returns("Result Hey 9, 5");
13321339

13331340
#endregion
13341341
}

CodingSeb.ExpressionEvaluator.Tests/Resources.Designer.cs

Lines changed: 31 additions & 2 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
@@ -277,4 +277,10 @@
277277
<data name="Script0053" type="System.Resources.ResXFileRef, System.Windows.Forms">
278278
<value>resources\script0053.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
279279
</data>
280+
<data name="Script0054" type="System.Resources.ResXFileRef, System.Windows.Forms">
281+
<value>resources\script0054.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
282+
</data>
283+
<data name="Script0055" type="System.Resources.ResXFileRef, System.Windows.Forms">
284+
<value>resources\script0055.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
285+
</data>
280286
</root>

CodingSeb.ExpressionEvaluator.Tests/Resources/Script0053.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Script0051 */
1+
/* Script0053 */
22
x = new
33
{
44
Hello = 3,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* Script0054 */
2+
myStruct.myIntvalue = 3;
3+
myStruct.myStringValue = "Test";
4+
5+
return $"Result {myStruct.myStringValue} {myStruct.myIntvalue}";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* Script0055 */
2+
otherStruct.AnOtherIntValue = 5;
3+
otherStruct.struct1 = new StructForTest1()
4+
{
5+
myIntvalue = 8,
6+
myStringValue = "Hey"
7+
};
8+
9+
otherStruct.struct1.myIntvalue = 9;
10+
11+
return $"Result {otherStruct.struct1.myStringValue} {otherStruct.struct1.myIntvalue}, {otherStruct.AnOtherIntValue}";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace CodingSeb.ExpressionEvaluator.Tests
2+
{
3+
public struct StructForTest2
4+
{
5+
public int AnOtherIntValue;
6+
public StructForTest1 struct1;
7+
}
8+
}

0 commit comments

Comments
 (0)