org.eclipse.xtext.preferences.MapBasedPreferenceValues Java Examples

The following examples show how to use org.eclipse.xtext.preferences.MapBasedPreferenceValues. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtendEnumFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatBraces_02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("enum Bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #2
Source File: XtendEnumFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatLiteral02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("enum Bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("FOO,");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("BAR,");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("BAZ");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #3
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodTwoAnnotations3() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterMethodAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override");
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("def foo() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormattedMember(_function, _builder.toString());
}
 
Example #4
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatDoWhile3() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("do");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.append("while (true)");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #5
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatConstructor02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("new()");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #6
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatIf1ML2() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(false));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("if(true)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"foo\")");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #7
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatDoWhile12() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(false));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("do");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("while(true)");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #8
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatField02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int foo");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int baz");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #9
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatFieldExtension02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("extension String");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("extension Integer");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #10
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatConstructorTwoAnnotationsSL1() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterConstructorAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override @Deprecated new() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("@Override ");
  _builder_1.newLine();
  _builder_1.append("@Deprecated ");
  _builder_1.newLine();
  _builder_1.append("new() {");
  _builder_1.newLine();
  _builder_1.append("}");
  _builder_1.newLine();
  this.assertFormattedMember(_function, _builder.toString(), _builder_1);
}
 
Example #11
Source File: XtendOnelinersFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@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);
}
 
Example #12
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod04() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("interface bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("public abstract def baz()");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #13
Source File: XbaseFormatterTest.java    From xtext-extras with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatTryCatchExpression12() {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Boolean>put(XbaseFormatterPreferenceKeys.whitespaceBetweenKeywordAndParenthesisML, Boolean.valueOf(false));
    };
    it.preferences(_function_1);
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("try");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"x\")");
    _builder.newLine();
    _builder.append("catch(Exception e)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("println(\"y\")");
    _builder.newLine();
    it.setToBeFormatted(_builder);
  };
  this._xbaseFormatterTester.assertFormattedExpression(_function);
}
 
Example #14
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("interface bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def baz()");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #15
Source File: XtendOnelinersFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodWithTwoExpressions2() {
  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();
  this.assertFormatted(_function, _builder);
}
 
Example #16
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatClassSingleAnnotationML2() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(true));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("@Deprecated");
  _builder.newLine();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("package foo @Deprecated class bar { }");
  _builder_1.newLine();
  this.assertFormatted(_function, _builder, _builder_1);
}
 
Example #17
Source File: XtendOnelinersFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@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);
}
 
Example #18
Source File: XtendFileFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatClass112() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("class bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int member1");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #19
Source File: AbstractXtendFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
public void assertFormatted(final Procedure1<? super MapBasedPreferenceValues> cfg, final CharSequence expectation, final CharSequence toBeFormatted, final String prefix, final String postfix, final boolean allowErrors) {
  final Procedure1<FormatterTestRequest> _function = (FormatterTestRequest it) -> {
    final Procedure1<MapBasedPreferenceValues> _function_1 = (MapBasedPreferenceValues it_1) -> {
      it_1.<Integer>put(FormatterPreferenceKeys.maxLineWidth, Integer.valueOf(80));
      it_1.<Boolean>put(XtendFormatterPreferenceKeys.keepOneLineMethods, Boolean.valueOf(false));
      if (cfg!=null) {
        cfg.apply(it_1);
      }
    };
    it.preferences(_function_1);
    it.setExpectation(((prefix + expectation) + postfix));
    it.setToBeFormatted(((prefix + toBeFormatted) + postfix));
    Collection<ITextRegion> _regions = it.getRequest().getRegions();
    int _length = prefix.length();
    int _length_1 = toBeFormatted.length();
    TextRegion _textRegion = new TextRegion(_length, _length_1);
    _regions.add(_textRegion);
    it.setAllowSyntaxErrors(allowErrors);
  };
  this.tester.assertFormatted(_function);
}
 
Example #20
Source File: XtendClassFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethod02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("class bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def baz()");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("{");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #21
Source File: XtendAnnotationTypeFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatField02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("annotation Bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int foo");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int baz");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #22
Source File: XtendAnnotationTypeFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Ignore
@Test
public void formatFieldInit02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("annotation Bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int foo = 1 + 1");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int baz = 1 + 1");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #23
Source File: XtendAnnotationTypeFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Ignore
@Test
public void formatFieldInit04() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("annotation Bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("val foo = 1 + 1");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("val baz = 1 + 1");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #24
Source File: XtendAnnotationTypeFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatBraces_02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.bracesInNewLine, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("annotation Bar");
  _builder.newLine();
  _builder.append("{");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #25
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatField02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("interface bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int foo");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int baz");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #26
Source File: XtendInterfaceFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatFieldInit02() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("interface bar {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int foo = 1 + 1");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("int baz = 1 + 1");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  this.assertFormatted(_function, _builder);
}
 
Example #27
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodTwoAnnotations4() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterMethodAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(false));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("@Override @Deprecated def foo() {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("@Override  ");
  _builder_1.newLine();
  _builder_1.append("@Deprecated  ");
  _builder_1.newLine();
  _builder_1.append("def foo() {  }");
  _builder_1.newLine();
  this.assertFormattedMember(_function, _builder.toString(), _builder_1);
}
 
Example #28
Source File: XtendOnelinersFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatMethodWithOneExpression4() {
  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);
}
 
Example #29
Source File: XtendOnelinersFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatEmptyMethod4() {
  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("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("class C {");
  _builder_1.newLine();
  _builder_1.append("\t");
  _builder_1.append("def m() {          }");
  _builder_1.newLine();
  _builder_1.append("}");
  _builder_1.newLine();
  this.assertFormatted(_function, _builder, _builder_1);
}
 
Example #30
Source File: XtendAnnotationsFormatterTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void formatClassSingleAnnotationSL() {
  final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
    it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterClassAnnotations, Boolean.valueOf(false));
    it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
  };
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("package foo");
  _builder.newLine();
  _builder.newLine();
  _builder.append("@Deprecated class bar {");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  StringConcatenation _builder_1 = new StringConcatenation();
  _builder_1.append("package foo @Deprecated class bar { }");
  _builder_1.newLine();
  this.assertFormatted(_function, _builder, _builder_1);
}