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
@@ -58,6 +58,48 @@ public class StringLiteralStatementsTests
YesNtAssert.IsLastLineEqual(lines, "hello world");
}
[TestMethod]
public void EmptyStringLiteralHasLengthZeroTest()
{
List<string> lines =
[
"var x = \"\"",
"length ${x}",
"var len = %out",
"${len}"
];
YesNtAssert.IsLastLineEqual(lines, "0");
}
[TestMethod]
public void EscapedBackslashProducesLiteralBackslashTest()
{
List<string> lines =
[
"var msg = \"\\\\n\"", // YesNt source: "\\n" → \n (backslash + n, 2 chars)
"length ${msg}",
"var len = %out",
"${len}"
];
YesNtAssert.IsLastLineEqual(lines, "2");
}
[TestMethod]
public void UnknownEscapeSequenceBecomesCharTest()
{
List<string> lines =
[
"var msg = \"\\q\"", // YesNt source: "\q" → q (1 char)
"length ${msg}",
"var len = %out",
"${len}"
];
YesNtAssert.IsLastLineEqual(lines, "1");
}
[TestMethod]
public void UnterminatedStringLiteralFailsTest()
{