use of org.eclipse.xtend.core.xtend.XtendMember in project xtext-xtend by eclipse.
the class XtendUnsugaredHoverTest method testBug414204_1.
@Test
public void testBug414204_1() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package testpackage");
_builder.newLine();
_builder.append("import static testpackage.Bar.*");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def stuff(){");
_builder.newLine();
_builder.append("\t\t");
_builder.append("doStaticStuff()");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("class Bar {");
_builder.newLine();
_builder.append("\t");
_builder.append("def static void doStaticStuff(){");
_builder.newLine();
_builder.append("\t\t");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile xtendFile = this.testHelper.xtendFile(XtendUnsugaredHoverTest.FILEPATH, _builder.toString());
IResourcesSetupUtil.waitForBuild();
XtendMember _get = IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(xtendFile.getXtendTypes(), XtendClass.class)).getMembers().get(0);
final XtendFunction function = ((XtendFunction) _get);
XExpression _expression = function.getExpression();
final XBlockExpression block = ((XBlockExpression) _expression);
final XExpression call = block.getExpressions().get(0);
Assert.assertEquals("", this.serializer.computeUnsugaredExpression(call));
}
use of org.eclipse.xtend.core.xtend.XtendMember in project xtext-xtend by eclipse.
the class XtendUnsugaredHoverTest method testUnsuagaredVersionForXtendFunction_9.
@Test
public void testUnsuagaredVersionForXtendFunction_9() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package testpackage");
_builder.newLine();
_builder.append("import java.util.ArrayList");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("extension Extension");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("def baz(String it){");
_builder.newLine();
_builder.append("\t\t");
_builder.append("substring(0)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile xtendFile = this.testHelper.xtendFile(XtendUnsugaredHoverTest.FILEPATH, _builder.toString());
IResourcesSetupUtil.waitForBuild();
XtendMember _get = IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(xtendFile.getXtendTypes(), XtendClass.class)).getMembers().get(1);
final XtendFunction function = ((XtendFunction) _get);
XExpression _expression = function.getExpression();
final XBlockExpression block = ((XBlockExpression) _expression);
final XExpression call = block.getExpressions().get(0);
Assert.assertEquals("it.substring(0)", this.serializer.computeUnsugaredExpression(call));
}
use of org.eclipse.xtend.core.xtend.XtendMember in project xtext-xtend by eclipse.
the class XtendUnsugaredHoverTest method testBug373054.
@Test
public void testBug373054() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package testpackage");
_builder.newLine();
_builder.append("import static extension testpackage.Extension.*");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def bar(){}");
_builder.newLine();
_builder.append("\t");
_builder.append("def baz(String it, String s){");
_builder.newLine();
_builder.append("\t\t");
_builder.append("zonk = s + s + s");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile xtendFile = this.testHelper.xtendFile(XtendUnsugaredHoverTest.FILEPATH, _builder.toString());
IResourcesSetupUtil.waitForBuild();
XtendMember _get = IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(xtendFile.getXtendTypes(), XtendClass.class)).getMembers().get(1);
final XtendFunction function = ((XtendFunction) _get);
XExpression _expression = function.getExpression();
final XBlockExpression block = ((XBlockExpression) _expression);
final XExpression call = block.getExpressions().get(0);
Assert.assertEquals("Extension.setZonk(it, s + s + s)", this.serializer.computeUnsugaredExpression(call));
}
use of org.eclipse.xtend.core.xtend.XtendMember in project xtext-xtend by eclipse.
the class XtendUnsugaredHoverTest method testUnsuagaredVersionForXtendFunction_5.
@Test
public void testUnsuagaredVersionForXtendFunction_5() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package testpackage");
_builder.newLine();
_builder.append("import java.util.ArrayList");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("extension Extension");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("\t");
_builder.append("def baz(Integer it){");
_builder.newLine();
_builder.append("\t\t");
_builder.append("new ArrayList<String>().bar(42)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile xtendFile = this.testHelper.xtendFile(XtendUnsugaredHoverTest.FILEPATH, _builder.toString());
IResourcesSetupUtil.waitForBuild();
XtendMember _get = IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(xtendFile.getXtendTypes(), XtendClass.class)).getMembers().get(1);
final XtendFunction function = ((XtendFunction) _get);
XExpression _expression = function.getExpression();
final XBlockExpression block = ((XBlockExpression) _expression);
final XExpression call = block.getExpressions().get(0);
Assert.assertEquals("this._extension.bar(new ArrayList<String>(), 42)", this.serializer.computeUnsugaredExpression(call));
}
use of org.eclipse.xtend.core.xtend.XtendMember in project xtext-xtend by eclipse.
the class XtendUnsugaredHoverTest method testBug380361_1.
@Test
public void testBug380361_1() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("package testpackage");
_builder.newLine();
_builder.append("import static java.lang.Integer.*");
_builder.newLine();
_builder.append("import static extension java.lang.String.*");
_builder.newLine();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def void foo(String it) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("valueOf()");
_builder.newLine();
_builder.append("\t\t");
_builder.append("valueOf(it)");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile xtendFile = this.testHelper.xtendFile(XtendUnsugaredHoverTest.FILEPATH, _builder.toString());
IResourcesSetupUtil.waitForBuild();
XtendMember _get = IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(xtendFile.getXtendTypes(), XtendClass.class)).getMembers().get(0);
final XtendFunction function = ((XtendFunction) _get);
XExpression _expression = function.getExpression();
final XBlockExpression block = ((XBlockExpression) _expression);
final XExpression call = block.getExpressions().get(0);
final XExpression call2 = block.getExpressions().get(1);
Assert.assertEquals("String.valueOf(it)", this.serializer.computeUnsugaredExpression(call));
Assert.assertEquals("", this.serializer.computeUnsugaredExpression(call2));
}
Aggregations