use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug409602Test method test_06.
@Test
public void test_06() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("val ()=>void res = [|");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("if (\"\" == null) {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("return");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("1");
_builder.newLine();
_builder.append("\t\t");
_builder.append("]");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return res");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertError(file, XbasePackage.Literals.XNUMBER_LITERAL, IssueCodes.INVALID_INNER_EXPRESSION);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug409602Test method test_18.
@Test
public void test_18() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("val ()=>void res = [|");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("if (\"\" == null) {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("return 1");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("return");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("]");
_builder.newLine();
_builder.append("\t\t");
_builder.append("res");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertError(file, XbasePackage.Literals.XRETURN_EXPRESSION, IssueCodes.INVALID_RETURN, "Void functions cannot return a value.");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug409602Test method test_20.
@Test
public void test_20() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("while(true)");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("return \'\'");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertNoErrors(file);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug409602Test method test_21.
@Test
public void test_21() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m(boolean b) {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("while(b)");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("return \'\'");
_builder.newLine();
_builder.append("\t\t");
_builder.append("return \'\'");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertNoErrors(file);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.
the class ValidationBug409602Test method test_14.
@Test
public void test_14() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("[|");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("if (\"\" == null) {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("return");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("} else {");
_builder.newLine();
_builder.append("\t\t\t\t");
_builder.append("return 1");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t\t");
_builder.append("]");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final XtendFile file = this.parser.parse(_builder);
this.helper.assertError(file, XbasePackage.Literals.XRETURN_EXPRESSION, IssueCodes.INVALID_RETURN, "Void functions cannot return a value.");
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations