Search in sources :

Example 66 with MapBasedPreferenceValues

use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.

the class XtendAnnotationsFormatterTest method formatConstructorTwoAnnotations1.

@Test
public void formatConstructorTwoAnnotations1() {
    final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
        it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterConstructorAnnotations, 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("new() {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    this.assertFormattedMember(_function, _builder.toString());
}
Also used : MapBasedPreferenceValues(org.eclipse.xtext.preferences.MapBasedPreferenceValues) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendFormatterTest(org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest) Test(org.junit.Test)

Example 67 with MapBasedPreferenceValues

use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.

the class XtendAnnotationsFormatterTest method formatFieldSingleAnnotations1.

@Test
public void formatFieldSingleAnnotations1() {
    final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
        it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterFieldAnnotations, Boolean.valueOf(true));
        it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
    };
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Override");
    _builder.newLine();
    _builder.append("int value");
    _builder.newLine();
    this.assertFormattedMember(_function, _builder.toString());
}
Also used : MapBasedPreferenceValues(org.eclipse.xtext.preferences.MapBasedPreferenceValues) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendFormatterTest(org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest) Test(org.junit.Test)

Example 68 with MapBasedPreferenceValues

use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.

the class XtendAnnotationsFormatterTest method formatFieldSingleAnnotations2.

@Test
public void formatFieldSingleAnnotations2() {
    final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
        it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterFieldAnnotations, Boolean.valueOf(false));
        it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(false));
    };
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Override int value");
    _builder.newLine();
    this.assertFormattedMember(_function, _builder.toString());
}
Also used : MapBasedPreferenceValues(org.eclipse.xtext.preferences.MapBasedPreferenceValues) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendFormatterTest(org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest) Test(org.junit.Test)

Example 69 with MapBasedPreferenceValues

use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.

the class XtendAnnotationsFormatterTest method formatMethodParameterTwoAnnotations2.

@Ignore
@Test
public void formatMethodParameterTwoAnnotations2() {
    final Procedure1<MapBasedPreferenceValues> _function = (MapBasedPreferenceValues it) -> {
        it.<Boolean>put(XbaseFormatterPreferenceKeys.newLineAfterParameterAnnotations, Boolean.valueOf(true));
        it.<Boolean>put(XbaseFormatterPreferenceKeys.preserveNewLines, Boolean.valueOf(true));
    };
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("def foo(");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Override");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("@Deprecated");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("String p) {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("def foo(  @Override  @Deprecated  String  p  ) {  }");
    _builder_1.newLine();
    this.assertFormattedMember(_function, _builder.toString(), _builder_1);
}
Also used : MapBasedPreferenceValues(org.eclipse.xtext.preferences.MapBasedPreferenceValues) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Ignore(org.junit.Ignore) AbstractXtendFormatterTest(org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest) Test(org.junit.Test)

Example 70 with MapBasedPreferenceValues

use of org.eclipse.xtext.preferences.MapBasedPreferenceValues in project xtext-xtend by eclipse.

the class XtendAnnotationsFormatterTest method formatMethodTwoAnnotations4.

@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);
}
Also used : MapBasedPreferenceValues(org.eclipse.xtext.preferences.MapBasedPreferenceValues) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendFormatterTest(org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest) Test(org.junit.Test)

Aggregations

MapBasedPreferenceValues (org.eclipse.xtext.preferences.MapBasedPreferenceValues)106 Test (org.junit.Test)100 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)99 AbstractXtendFormatterTest (org.eclipse.xtend.core.tests.formatting.AbstractXtendFormatterTest)91 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)14 IFormattableDocument (org.eclipse.xtext.formatting2.IFormattableDocument)8 IHiddenRegionFormatter (org.eclipse.xtext.formatting2.IHiddenRegionFormatter)8 GenericFormatter (org.eclipse.xtext.formatting2.internal.GenericFormatter)8 GenericFormatterTestRequest (org.eclipse.xtext.formatting2.internal.GenericFormatterTestRequest)8 ITextRegionExtensions (org.eclipse.xtext.formatting2.regionaccess.ITextRegionExtensions)8 KWList (org.eclipse.xtext.formatting2.internal.formattertestlanguage.KWList)7 FormatterTestRequest (org.eclipse.xtext.testing.formatter.FormatterTestRequest)6 Ignore (org.junit.Ignore)5 IAutowrapFormatter (org.eclipse.xtext.formatting2.IAutowrapFormatter)2 IFormattableSubDocument (org.eclipse.xtext.formatting2.IFormattableSubDocument)2 IHiddenRegionFormatting (org.eclipse.xtext.formatting2.IHiddenRegionFormatting)2 ISubFormatter (org.eclipse.xtext.formatting2.ISubFormatter)2 ITextReplacement (org.eclipse.xtext.formatting2.regionaccess.ITextReplacement)2 ITextSegment (org.eclipse.xtext.formatting2.regionaccess.ITextSegment)2 ITextRegion (org.eclipse.xtext.util.ITextRegion)2