Search in sources :

Example 96 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method missingMethodInAbstractClass.

@Test
public void missingMethodInAbstractClass() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("abstract class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def String foo() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("bar|()");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertFeatureCallLinkingIssue().assertResolutionLabels("Create method \'bar()\'");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("abstract class Foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def String foo() {");
    _builder_1.newLine();
    _builder_1.append("\t\t");
    _builder_1.append("bar()");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def String bar()");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertResolutionLabels.assertModelAfterQuickfix("Create method \'bar()\'", _builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 97 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method duplicateImport_9.

@Test
public void duplicateImport_9() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import static java.lang.String.*");
    _builder.newLine();
    _builder.append("import static extension java.lang.String.*|");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def foo() {");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("valueOf(1)");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(IssueCodes.IMPORT_UNUSED).assertResolutionLabels("Organize imports");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("import static java.lang.String.*");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("class Foo {");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def foo() {");
    _builder_1.newLine();
    _builder_1.append("\t\t");
    _builder_1.append("valueOf(1)");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 98 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method inconsistentIndentation.

@Test
public void inconsistentIndentation() {
    final String tripleQuotes = "\'\'\'";
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("def bar() ");
    _builder.append(tripleQuotes, "\t");
    _builder.newLineIfNotEmpty();
    _builder.append("\t\t");
    _builder.append("tab");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("|space");
    _builder.newLine();
    _builder.append("\t");
    _builder.append(tripleQuotes, "\t");
    _builder.newLineIfNotEmpty();
    _builder.append("}");
    _builder.newLine();
    QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(org.eclipse.xtend.core.validation.IssueCodes.INCONSISTENT_INDENTATION).assertResolutionLabels("Correct indentation");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("class Foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def bar() ");
    _builder_1.append(tripleQuotes, "\t");
    _builder_1.newLineIfNotEmpty();
    _builder_1.append("\t\t");
    _builder_1.append("tab");
    _builder_1.newLine();
    _builder_1.append("\t\t");
    _builder_1.append("space");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append(tripleQuotes, "\t");
    _builder_1.newLineIfNotEmpty();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 99 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method missingConstructorFromSuper.

@Test
public void missingConstructorFromSuper() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("new(int i) {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Bar| extends Foo {");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(org.eclipse.xtend.core.validation.IssueCodes.MISSING_CONSTRUCTOR).assertResolutionLabels("Add constructor new(int)");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("class Foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("new(int i) {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.newLine();
    _builder_1.append("class Bar extends Foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("new(int i) {");
    _builder_1.newLine();
    _builder_1.append("\t\t");
    _builder_1.append("super(i)");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Example 100 with QuickfixTestBuilder

use of org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder in project xtext-xtend by eclipse.

the class QuickfixTest method obsoleteOverride.

@Test
public void obsoleteOverride() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("class Foo {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("override| bar() {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    QuickfixTestBuilder _assertResolutionLabels = this.builder.create("Foo.xtend", _builder).assertIssueCodes(org.eclipse.xtend.core.validation.IssueCodes.OBSOLETE_OVERRIDE).assertResolutionLabels("Change \'override\' to \'def\'");
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("class Foo {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("def bar() {");
    _builder_1.newLine();
    _builder_1.append("\t");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _assertResolutionLabels.assertModelAfterQuickfix(_builder_1);
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) QuickfixTestBuilder(org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder) Test(org.junit.Test)

Aggregations

QuickfixTestBuilder (org.eclipse.xtend.ide.tests.quickfix.QuickfixTestBuilder)122 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)122 Test (org.junit.Test)122 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 XtextEditor (org.eclipse.xtext.ui.editor.XtextEditor)1