Skip to content

Commit

Permalink
also verify error position for EXCEPTION_DECLARED_TWICE
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Feb 5, 2024
1 parent 7c0636b commit 778230f
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1692,8 +1692,11 @@ protected void assertNoConformanceError(String body) throws Exception {
}

@Test public void testExceptionsDeclaredTwiceOnConstructor() throws Exception {
XtendClass clazz = clazz("import java.io.IOException class X { new () throws IOException, IOException { }}");
helper.assertError(clazz, XTEND_CONSTRUCTOR, EXCEPTION_DECLARED_TWICE, "Exception", "declared", "twice");
var source = "import java.io.IOException class X { new () throws IOException, IOException { }}";
XtendClass clazz = clazz(source);
helper.assertError(clazz, XTEND_CONSTRUCTOR, EXCEPTION_DECLARED_TWICE,
source.lastIndexOf("IOException"), "IOException".length(),
"IOException", "declared", "twice");
}

@Test public void testExceptionsNotDeclaredTwiceOnConstructor() throws Exception {
Expand All @@ -1702,8 +1705,11 @@ protected void assertNoConformanceError(String body) throws Exception {
}

@Test public void testExceptionsDeclaredTwiceOnFunction() throws Exception {
XtendClass clazz = clazz("import java.io.IOException class X {def foo() throws IOException, IOException { }}");
helper.assertError(clazz, XTEND_FUNCTION, EXCEPTION_DECLARED_TWICE, "Exception", "declared", "twice");
var source = "import java.io.IOException class X {def foo() throws IOException, IOException { }}";
XtendClass clazz = clazz(source);
helper.assertError(clazz, XTEND_FUNCTION, EXCEPTION_DECLARED_TWICE,
source.lastIndexOf("IOException"), "IOException".length(),
"IOException", "declared", "twice");
}

@Test public void testExceptionsNotDeclaredTwiceOnFunction() throws Exception {
Expand Down

0 comments on commit 778230f

Please sign in to comment.