use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.
the class XtendOnelinersFormatterTest method formatMethodWithOneExpression2.
@Test
public void formatMethodWithOneExpression2() {
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(true));
};
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("\"Foo\"");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.assertFormatted(_function, _builder);
}
use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.
the class XtendOnelinersFormatterTest method formatEmptyMethod2.
@Test
public void formatEmptyMethod2() {
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(true));
};
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
this.assertFormatted(_function, _builder);
}
use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.
the class XtendOnelinersFormatterTest method formatMethodWithTryCatchExpression.
@Test
public void formatMethodWithTryCatchExpression() {
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(true));
};
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("try {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("\"Foo\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("} catch (Exception e) {");
_builder.newLine();
_builder.append("\t\t\t");
_builder.append("\"Bar\"");
_builder.newLine();
_builder.append("\t\t");
_builder.append("}");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class C {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def m() {try{\"Foo\"} catch (Exception e) {\"Bar\"} }");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.assertFormatted(_function, _builder, _builder_1);
}
use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.
the class XtendOnelinersFormatterTest method formatMethodWithTwoExpressions4.
@Test
public void formatMethodWithTwoExpressions4() {
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(true));
};
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("println(this)");
_builder.newLine();
_builder.append("\t\t");
_builder.append("\"Foo\"");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class C {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def m() { println(this) \"Foo\" }");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.assertFormatted(_function, _builder, _builder_1);
}
use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.
the class XtendOnelinersFormatterTest method formatMethodWithJustAComment4.
@Test
public void formatMethodWithJustAComment4() {
final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
it.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(true));
};
StringConcatenation _builder = new StringConcatenation();
_builder.append("class C {");
_builder.newLine();
_builder.append("\t");
_builder.append("def m() { /*foo*/ }");
_builder.newLine();
_builder.append("}");
_builder.newLine();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class C {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("def m() { /*foo*/ }");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
this.assertFormatted(_function, _builder, _builder_1);
}
Aggregations