mirror of
https://github.com/Stone-Red-Code/YesNt-Interpreter.git
synced 2026-09-08 07:56:06 +02:00
Add tests for loop exit, local/global scope, concurrency, and string escapes
This commit is contained in:
@@ -91,6 +91,34 @@ public class VariableStatementsTests
|
||||
YesNtAssert.ContainsTerminationMessage(lines, "Invalid syntax");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void OverwriteVariableTest()
|
||||
{
|
||||
List<string> lines =
|
||||
[
|
||||
"var x = first",
|
||||
"var x = second",
|
||||
"${x}"
|
||||
];
|
||||
|
||||
YesNtAssert.IsLastLineEqual(lines, "second");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EmptyStringVariableHasLengthZeroTest()
|
||||
{
|
||||
List<string> lines =
|
||||
[
|
||||
"var x = \"\"",
|
||||
"length ${x}",
|
||||
"var len = %out",
|
||||
"${len}"
|
||||
];
|
||||
|
||||
YesNtAssert.IsLastLineEqual(lines, "0");
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void MissingVariableReferenceFailsTest()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user