Skip to content

Commit

Permalink
also verify error position for EXCEPTION_NOT_THROWABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Feb 5, 2024
1 parent c66e929 commit 45f2c86
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1676,13 +1676,19 @@ protected void assertNoConformanceError(String body) throws Exception {
}

@Test public void testConstructorThrownExceptionsOfTypeThrowable() throws Exception {
XtendClass clazz = clazz("class X { new () throws Integer { }}");
helper.assertError(clazz, XTEND_CONSTRUCTOR, EXCEPTION_NOT_THROWABLE, "No", "can", "subclass", "Throwable");
var source = "class X { new () throws Integer { }}";
XtendClass clazz = clazz(source);
helper.assertError(clazz, XTEND_CONSTRUCTOR, EXCEPTION_NOT_THROWABLE,
source.indexOf("Integer"), "Integer".length(),
"No", "can", "subclass", "Throwable");
}

@Test public void testFunctionThrownExceptionsOfTypeThrowable() throws Exception {
XtendClass clazz = clazz("class X { def foo() throws Integer { } }");
helper.assertError(clazz, XTEND_FUNCTION, EXCEPTION_NOT_THROWABLE, "No", "can", "subclass", "Throwable");
var source = "class X { def foo() throws Integer { } }";
XtendClass clazz = clazz(source);
helper.assertError(clazz, XTEND_FUNCTION, EXCEPTION_NOT_THROWABLE,
source.indexOf("Integer"), "Integer".length(),
"No", "can", "subclass", "Throwable");
}

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

0 comments on commit 45f2c86

Please sign in to comment.