Search in sources :

Example 1 with ContentAssistProcessorTestBuilder

use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.

the class EclipseBug28DirtyStateModifierContentAssistTest method testDirtyStateModifiers_01.

@Test
public void testDirtyStateModifiers_01() throws Exception {
    final ContentAssistProcessorTestBuilder builder = newBuilder().withDirtyState().appendNl("final class FooA1 {}").appendNl("class FooA2 {}").append("class FooA3 extends FooA").assertText("FooA2", "FooA3");
    assertNoText(builder, "FooA1");
}
Also used : ContentAssistProcessorTestBuilder(org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder) Test(org.junit.Test)

Example 2 with ContentAssistProcessorTestBuilder

use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.

the class Bug458611Test method test_04.

@Test
public void test_04() throws Exception {
    ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import static extension C.Foo.*");
    _builder.newLine();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Bar {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Foo {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("static def sum(Iterable<Bar> bars) {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def doit(Bar[] myBars) {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("myBars.sum<|>");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _newBuilder.append(_builder.toString()).assertProposalAtCursor("sum");
}
Also used : ContentAssistProcessorTestBuilder(org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendContentAssistBugTest(org.eclipse.xtend.ide.tests.contentassist.AbstractXtendContentAssistBugTest) Test(org.junit.Test)

Example 3 with ContentAssistProcessorTestBuilder

use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.

the class Bug458611Test method test_02.

@Test
public void test_02() throws Exception {
    ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import static extension C.Foo.*");
    _builder.newLine();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Bar {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("static class Foo {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("static def sum(Bar[] bars) {");
    _builder.newLine();
    _builder.append("\t    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def doit(Iterable<Bar> myBars) {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("myBars.sum<|>");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _newBuilder.append(_builder.toString()).assertProposalAtCursor("sum");
}
Also used : ContentAssistProcessorTestBuilder(org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendContentAssistBugTest(org.eclipse.xtend.ide.tests.contentassist.AbstractXtendContentAssistBugTest) Test(org.junit.Test)

Example 4 with ContentAssistProcessorTestBuilder

use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.

the class Bug460093Test method testMethodOverrides1.

@Test
public void testMethodOverrides1() {
    try {
        ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("import java.util.List");
        _builder.newLine();
        _builder.newLine();
        _builder.append("interface I extends List<String> {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("str");
        ContentAssistProcessorTestBuilder _applyProposal = _newBuilder.append(_builder.toString()).assertText("\n\toverride stream() {\n\t\tList.super.stream()\n\t}").applyProposal();
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append("import java.util.List");
        _builder_1.newLine();
        _builder_1.newLine();
        _builder_1.append("interface I extends List<String> {");
        _builder_1.newLine();
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("override stream() {");
        _builder_1.newLine();
        _builder_1.append("\t\t");
        _builder_1.append("List.super.stream()");
        _builder_1.newLine();
        _builder_1.append("\t");
        _builder_1.append("}");
        _applyProposal.expectContent(_builder_1.toString());
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : ContentAssistProcessorTestBuilder(org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendContentAssistBugTest(org.eclipse.xtend.ide.tests.contentassist.AbstractXtendContentAssistBugTest) Test(org.junit.Test)

Example 5 with ContentAssistProcessorTestBuilder

use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.

the class Bug461923Test method test_11.

@Test
public void test_11() throws Exception {
    ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import java.util.List");
    _builder.newLine();
    _builder.append("import com.google.common.collect.ImmutableList");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class C {");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def static <T extends CharSequence> m(List<? extends T> list, T value) {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("ImmutableList.builder.addAll(list.<|>filter[it != value]).build");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("def static sum(List<? extends Number> list) {");
    _builder.newLine();
    _builder.append("        ");
    _builder.append("null");
    _builder.newLine();
    _builder.append("    ");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    _newBuilder.append(_builder.toString()).assertNoProposalAtCursor("sum");
}
Also used : ContentAssistProcessorTestBuilder(org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) AbstractXtendContentAssistBugTest(org.eclipse.xtend.ide.tests.contentassist.AbstractXtendContentAssistBugTest) Test(org.junit.Test)

Aggregations

ContentAssistProcessorTestBuilder (org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder)185 Test (org.junit.Test)184 AbstractXtendContentAssistBugTest (org.eclipse.xtend.ide.tests.contentassist.AbstractXtendContentAssistBugTest)183 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)182 Flaky (org.eclipse.xtext.testing.Flaky)13 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)4 List (java.util.List)1