From 2f8e32636912e23552f5b43a2c84109b77fe7a92 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 28 Sep 2023 12:05:32 +0100 Subject: Attach source to all compiler errors --- src/test/java/org/shedlang/compiler/backends/ExampleTests.java | 8 ++++---- .../org/shedlang/compiler/parser/ParserStringLiteralTests.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/test/java/org') diff --git a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java index 5a6a7cbc..037041f3 100644 --- a/src/test/java/org/shedlang/compiler/backends/ExampleTests.java +++ b/src/test/java/org/shedlang/compiler/backends/ExampleTests.java @@ -3,10 +3,10 @@ package org.shedlang.compiler.backends; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.shedlang.compiler.ShedCompiler; -import org.shedlang.compiler.testing.ExecutionResult; import org.shedlang.compiler.config.ProjectConfig; -import org.shedlang.compiler.errors.SourceError; +import org.shedlang.compiler.errors.CompilerError; import org.shedlang.compiler.filesystem.ShedCompilerFiles; +import org.shedlang.compiler.testing.ExecutionResult; import org.shedlang.compiler.testing.TestProcessRunner; import org.shedlang.compiler.util.P; @@ -33,8 +33,8 @@ public abstract class ExampleTests { try { compiler.compile(exampleDirectory.toPath(), backend); - } catch (SourceError error) { - System.err.println(error.getSource().describe()); + } catch (CompilerError error) { + System.err.println(error.source().describe()); throw error; } diff --git a/src/test/java/org/shedlang/compiler/parser/ParserStringLiteralTests.java b/src/test/java/org/shedlang/compiler/parser/ParserStringLiteralTests.java index 6f4dbfc3..a9401cf9 100644 --- a/src/test/java/org/shedlang/compiler/parser/ParserStringLiteralTests.java +++ b/src/test/java/org/shedlang/compiler/parser/ParserStringLiteralTests.java @@ -47,7 +47,7 @@ public class ParserStringLiteralTests { ); assertThat(error.getMessage(), equalTo("Unrecognised escape sequence: \\a")); - assertThat(error.getSource(), instanceOf(FileFragmentSource.class, allOf( + assertThat(error.source(), instanceOf(FileFragmentSource.class, allOf( has("characterIndexStart", x -> x.characterIndexStart(), equalTo(1)), has("characterIndexEnd", x -> x.characterIndexEnd(), equalTo(3)) ))); -- cgit v1.2.3