Add tests for loop exit, local/global scope, concurrency, and string escapes

This commit is contained in:
Stone_Red
2026-03-05 01:26:16 +01:00
parent 265f20d4b7
commit ecb6415457
5 changed files with 215 additions and 0 deletions
@@ -63,6 +63,32 @@ public class ProcessingStatementsTests
YesNtAssert.IsLastLineEqual(lines, "hello\nworld");
}
[TestMethod]
public void CalcRespectsPrecedenceTest()
{
YesNtAssert.IsLineEqual("2 + 3 * 4 calc", "14");
}
[TestMethod]
public void CalcParenthesesOverridePrecedenceTest()
{
YesNtAssert.IsLineEqual("(2 + 3) * 4 calc", "20");
}
[TestMethod]
public void SleepZeroIsValidTest()
{
List<string> lines =
[
"sleep 0",
"var result = ok",
"${result}"
];
YesNtAssert.IsLastLineEqual(lines, "ok");
}
[TestMethod]
public void SleepInvalidValueFailsTest()
{
@@ -152,5 +178,26 @@ public class ProcessingStatementsTests
YesNtAssert.IsLastLineEqual(lines, "1", timeout: 3000);
}
[TestMethod]
public void MultipleTasksRunConcurrentlyTest()
{
List<string> lines =
[
"global a = 0",
"global b = 0",
"global a = 1 task",
"global b = 2 task",
"while ${a} == 0:",
"sleep 10",
"end_while",
"while ${b} == 0:",
"sleep 10",
"end_while",
"${b}"
];
YesNtAssert.IsLastLineEqual(lines, "2", timeout: 3000);
}
}