use of org.eclipse.xtend.core.xtend.XtendFunction in project xtext-xtend by eclipse.
the class UTF8ParserTest method testIdentifiers_01.
@Test
public void testIdentifiers_01() throws Exception {
XtendFunction func = function("def \u03b1\u03c1\u03b5\u03c4\u03b7() {}");
assertEquals("\u03b1\u03c1\u03b5\u03c4\u03b7", func.getName());
}
use of org.eclipse.xtend.core.xtend.XtendFunction in project xtext-xtend by eclipse.
the class AbstractRichStringTest method richString.
protected RichString richString(String string) throws Exception {
XtendClass clazz = clazz(getPrefix() + string + "}");
XtendFunction function = (XtendFunction) clazz.getMembers().get(0);
return (RichString) function.getExpression();
}
use of org.eclipse.xtend.core.xtend.XtendFunction in project xtext-xtend by eclipse.
the class LinkingErrorTest method testBug_350167_03.
@Test
public void testBug_350167_03() throws Exception {
XtendFunction fun = function("def fun(Object o) {\n" + " if (true) ''.toString != null else { . }\n" + "}");
assertNoExceptions(fun);
}
use of org.eclipse.xtend.core.xtend.XtendFunction in project xtext-xtend by eclipse.
the class LinkingErrorTest method testBug_350167_02.
@Test
public void testBug_350167_02() throws Exception {
XtendFunction fun = function("def fun(Object o) {\n" + " try { ''.toString } catch(NullPointerException e) { . }\n" + "}");
assertNoExceptions(fun);
}
use of org.eclipse.xtend.core.xtend.XtendFunction in project xtext-xtend by eclipse.
the class LinkingErrorTest method testNoException_01.
@Test
public void testNoException_01() throws Exception {
XtendFunction function = function("def noException() {\n" + // exception case is Integeri
" val closure = [Integeri| return i]\n" + " for (x : 1..100) closure.apply(x)\n" + " }");
JvmTypeReference type = associations.getDirectlyInferredOperation(function).getReturnType();
assertTrue(type.getType() instanceof JvmVoid);
assertFalse(type.getType().eIsProxy());
assertNoExceptions(function);
}
Aggregations