Skip to content

Commit

Permalink
CompilerTest.assertIR uses IGV dumper
Browse files Browse the repository at this point in the history
  • Loading branch information
Akirathan committed Jan 31, 2025
1 parent c0d4ce4 commit 17cc5df
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
import org.enso.compiler.core.IR;
import org.enso.compiler.core.ir.Expression;
import org.enso.compiler.core.ir.Module;
import org.enso.test.utils.IRDumperTestWrapper;

public abstract class CompilerTests {
private static IRDumperTestWrapper irDumper = new IRDumperTestWrapper();

protected static Module parse(CharSequence code) {
Module ir = EnsoParser.compile(code);
assertNotNull("IR was generated", ir);
Expand Down Expand Up @@ -52,7 +55,18 @@ public static void assertEqualsIR(String msg, String testName, IR old, IR now)
StandardOpenOption.TRUNCATE_EXISTING,
StandardOpenOption.CREATE,
StandardOpenOption.WRITE);
fail("IRs contained in files " + file1 + " and " + file2 + " should equal: " + msg);
irDumper.dump(old, "CompilerTest", "old");
irDumper.dump(now, "CompilerTest", "now");
var errMsg = new StringBuilder();
errMsg.append("IRs differ: ").append(msg).append(System.lineSeparator());
errMsg
.append("Contained in files: ")
.append(file1.toAbsolutePath())
.append(" and ")
.append(file2.toAbsolutePath())
.append(System.lineSeparator());
errMsg.append("Also dumped to IGV graphs named 'CompilerTest'");
fail(errMsg.toString());
}
}

Expand Down

0 comments on commit 17cc5df

Please sign in to comment.