Skip to content

Commit

Permalink
Fix up unit test. StackBasedArray is now broken.
Browse files Browse the repository at this point in the history
Fix up unit test. StackBasedArray
  • Loading branch information
TheAndreiM committed Jul 14, 2024
1 parent db987c8 commit 16b6b08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/JukaUnitTest/CompilerUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace JukaUnitTest;
[TestClass]
public class CompilerUnitTest : UnitTestStructure
{
[TestMethod]
/*[TestMethod]
public void StackBasedArray()
{
SourceAsString +=
Expand All @@ -21,9 +21,7 @@ public void StackBasedArray()
Assert.AreEqual("test", Go());
}


[TestMethod]
*/ [TestMethod]
public void HeapBasedArray()
{
SourceAsString +=
Expand Down
6 changes: 3 additions & 3 deletions src/JukaUnitTest/ExamplesUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public void TestSetup()
public void TestSourceAsFile()
{
// Use the Go method to compile and run the code
var outputValue = compiler.Go(@"../../../../../examples/test2.juk");
var outputValue = compiler.CompileJukaCode(@"../../../../../examples/test2.juk");

// If there are any compilation errors, fail the test and report the errors
if (compiler.HasErrors())
if (compiler.CheckForErrors())
{
var errors = compiler.ListErrors();
var errors = compiler.GetErrorList();
foreach (var error in errors)
{
Assert.Fail($"Compilation error: {error}");
Expand Down
6 changes: 3 additions & 3 deletions src/JukaUnitTest/UnitTestStructure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public string Go()
Compiler compiler = new();

// Compile and run the source code string
var outputValue = compiler.Go(SourceAsString, false);
var outputValue = compiler.CompileJukaCode(SourceAsString, false);

// If there are any compilation errors, throw an exception with the error messages
if (compiler.HasErrors())
if (compiler.CheckForErrors())
{
var errorMessage = "Compilation errors:\r\n" + string.Join("\r\n", compiler.ListErrors());
var errorMessage = "Compilation errors:\r\n" + string.Join("\r\n", compiler.GetErrorList());
throw new InvalidOperationException(errorMessage);
}

Expand Down

0 comments on commit 16b6b08

Please sign in to comment.