Add new tests for console, function, system, variable, and code flow statements

This commit is contained in:
Stone_Red
2026-03-04 14:49:54 +01:00
parent 36d8735fbb
commit a5f521912e
9 changed files with 899 additions and 56 deletions
@@ -0,0 +1,48 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
namespace YesNt.Interpreter.Tests;
[TestClass]
public class SystemStatementsTests
{
[TestMethod]
public void ExecWithArgsRunsProcessTest()
{
List<string> lines =
[
"exec cmd with /c,echo yesnt",
"let exitCode = %out",
"${exitCode}"
];
YesNtAssert.IsLastLineEqual(lines, "0");
}
[TestMethod]
public void ExecWithInStackArgsRunsProcessTest()
{
List<string> lines =
[
"push_in /c",
"push_in echo yesnt",
"exec cmd",
"let exitCode = %out",
"${exitCode}"
];
YesNtAssert.IsLastLineEqual(lines, "0");
}
[TestMethod]
public void ExecInvalidProgramFailsTest()
{
List<string> lines =
[
"exec does_not_exist_abc_xyz"
];
YesNtAssert.ContainsTerminationMessage(lines, "Failed to start \"does_not_exist_abc_xyz\"");
}
}