diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-07-24 22:05:21 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-07-24 22:05:21 +0100 |
| commit | cfc5182da57c3fd073e5d4b880871f9d52cd9ada (patch) | |
| tree | 437be6570251086d3bbc74f9dd5a524b66a7e80c /src/test/java | |
| parent | 06f082a3c9d91a1f70f355f5229f1a8ea97fc70b (diff) | |
Print source of SourceError in ExampleTests
Diffstat (limited to 'src/test/java')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/backends/ExampleTests.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java index 551e553b..f3903746 100644 --- a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java +++ b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java @@ -5,6 +5,7 @@ import org.junit.jupiter.api.TestFactory; import org.shedlang.compiler.ShedCompiler; import org.shedlang.compiler.backends.llvm.ExecutionResult; import org.shedlang.compiler.config.ProjectConfig; +import org.shedlang.compiler.errors.SourceError; import org.shedlang.compiler.filesystem.ShedCompilerFiles; import org.shedlang.compiler.testing.TestProcessRunner; import org.shedlang.compiler.util.P; @@ -29,7 +30,14 @@ public abstract class ExampleTests { () -> { var backend = backend(); var compiler = new ShedCompiler(); - compiler.compile(exampleDirectory.toPath(), backend); + + try { + compiler.compile(exampleDirectory.toPath(), backend); + } catch (SourceError error) { + System.err.println(error.getSource().describe()); + throw error; + } + var config = ProjectConfig.read(exampleDirectory.toPath()); for (var example : config.examples()) { |
