org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder Java Examples

The following examples show how to use org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder. 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: Bug461923Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_02() 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> m(List<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.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("filter[]");
}
 
Example #2
Source File: Bug440858Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_02() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("annotation MyTest {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("static class MyInner {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor(Strings.toPlatformLineSeparator("\n\t\toverride toString() {\n\t\t\tsuper.toString()\n\t\t}\n\t\t"));
}
 
Example #3
Source File: Bug436564Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_04() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("val o = new Object() {");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("String s");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("toS<|>");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("override toString() {}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalDisplayedAtCursor("toString() - Override method from Object");
}
 
Example #4
Source File: Bug453271Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_17() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void m() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("C::thi<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertNoProposalAtCursor("this");
}
 
Example #5
Source File: Bug453271Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_15() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void m() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("C.thi<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("this");
}
 
Example #6
Source File: Bug402876Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testExtensionLocal_01() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void m(int i) {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("val extension String s = null");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("i.");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposal("subSequence()").withDisplayString("subSequence(int endIndex) : CharSequence - String");
}
 
Example #7
Source File: Bug440858Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_01() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("annotation MyTest {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("static class MyInner {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("toSt<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor(Strings.toPlatformLineSeparator("\n\t\toverride toString() {\n\t\t\tsuper.toString()\n\t\t}\n\t\t"));
}
 
Example #8
Source File: Bug461923Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_05() 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 m(List<String> list, String 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.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("filter[]");
}
 
Example #9
Source File: Bug453271Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_16() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void m() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("C.sup<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("super");
}
 
Example #10
Source File: Bug424903Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_01() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("import java.util.List");
  _builder.newLine();
  _builder.newLine();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("package val f1 = newArrayList(1)");
  _builder.newLine();
  _builder.newLine();
  _builder.append("\t");
  _builder.append("var List<Object> f2");
  _builder.newLine();
  _builder.newLine();
  _builder.append("\t");
  _builder.append("var f3 = new StringBuilde|");
  _builder.newLine();
  _builder.append("\t");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertTextAtCursorPosition("|", "StringBuilder");
}
 
Example #11
Source File: Bug370955Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Flaky
@Test
public void test_01() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void method(CharSequence c) {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("c.toString");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}\t");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertTextAtCursorPosition("toString", "toString".length(), 
    "!=", "!==", "+", "->", "<", "<=", "<=>", "==", "===", "=>", ">", ">=", "?:", 
    "toString");
}
 
Example #12
Source File: Bug436564Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_20() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("static class C2 {");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("def s() {}");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("toS<|>");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("override toString() {}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalDisplayedAtCursor("toString() - Override method from Object");
}
 
Example #13
Source File: Bug436564Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_16() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("static class C2 {");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("String s");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("toS<|>");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("override toString() {}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalDisplayedAtCursor("toString() - Override method from Object");
}
 
Example #14
Source File: Bug436564Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_02() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("val o = new Object() {");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("toS<|>");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("override toString() {}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalDisplayedAtCursor("toString() - Override method from Object");
}
 
Example #15
Source File: Bug436564Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_15() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("static class C2 {");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("String s");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("<|>");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("override toString() {}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalDisplayedAtCursor("toString() - Override method from Object");
}
 
Example #16
Source File: XImportSectionContentAssistTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testMemberName_4() {
  try {
    ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("package org.eclipse.xtend.ide.tests.data.contentassist");
    _builder.newLine();
    _builder.newLine();
    _builder.append("import static org.eclipse.xtend.ide.tests.data.contentassist.Foo.default");
    _builder.newLine();
    _builder.newLine();
    _builder.append("class Bar {}");
    _newBuilder.append(_builder.toString()).assertTextAtCursorPosition("default", "default".length(), "defaultStaticMethod", "defaultStaticField");
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #17
Source File: Bug461923Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_06() 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 m(List<? super String> list, String 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.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("filter[]");
}
 
Example #18
Source File: Bug453271Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_19() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("static def void m() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("C.thi<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertNoProposalAtCursor("this");
}
 
Example #19
Source File: Bug461923Test.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void test_01() 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> 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.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("filter[]");
}
 
Example #20
Source File: Bug439019Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBug463053_05() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("@A(value=#[NAME, <|>])");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("String s5");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _builder.append("annotation A {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("E[] value");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _builder.append("enum E {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("NAME");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("NAME");
}
 
Example #21
Source File: Bug439019Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBug463053_02() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("@A(NAME, <|>)");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("String s1");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _builder.append("annotation A {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("E[] value");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _builder.append("enum E {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("NAME");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("NAME");
}
 
Example #22
Source File: Bug370955Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Flaky
@Test
public void test_04() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void method(CharSequence c) {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("if (true) {");
  _builder.newLine();
  _builder.append("\t\t\t");
  _builder.append("method(c.toString)");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}\t");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertTextAtCursorPosition("toString", "toString".length(), 
    "!=", "!==", "+", "->", "<", "<=", "<=>", "==", "===", "=>", ">", ">=", "?:", 
    "toString");
}
 
Example #23
Source File: Bug439019Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_02() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("@A(NAME, NA<|>)");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("String s1");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _builder.append("annotation A {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("E[] value");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _builder.append("enum E {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("NAME");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("NAME");
}
 
Example #24
Source File: Bug453271Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_02() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("static def String getThingyDingy() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("\'\'");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void m() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("thin<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("thingyDingy");
}
 
Example #25
Source File: Bug458611Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@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");
}
 
Example #26
Source File: Bug436564Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_18() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("static class C2 {");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("String s");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("toS<|>");
  _builder.newLine();
  _builder.append("  \t");
  _builder.append("String s2");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("override toString() {}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalDisplayedAtCursor("toString() - Override method from Object");
}
 
Example #27
Source File: Bug453271Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_04() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("static def String getThingyDingy() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("\'\'");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void m() {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("C.thin<|>");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalAtCursor("thingyDingy");
}
 
Example #28
Source File: Bug402876Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testExtensionParameter_02() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("\t");
  _builder.append("def void m(int i, extension String s) {");
  _builder.newLine();
  _builder.append("\t\t");
  _builder.append("i.");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposal("charAt").withDisplayString("charAt : char - String.charAt()");
}
 
Example #29
Source File: Bug435043Test.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void test_27() throws Exception {
  ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("class C {");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("static class D {");
  _builder.newLine();
  _builder.append("\t  ");
  _builder.append("val foo = \"\"");
  _builder.newLine();
  _builder.append("\t  ");
  _builder.append("<|>");
  _builder.newLine();
  _builder.append("\t  ");
  _builder.append("override toString() {");
  _builder.newLine();
  _builder.append("\t    ");
  _builder.append("\"\"");
  _builder.newLine();
  _builder.append("\t  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("\t  ");
  _builder.newLine();
  _builder.append("\t  ");
  _builder.append("val bar = \"\"");
  _builder.newLine();
  _builder.append("\t  ");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("}");
  _builder.newLine();
  _builder.append("}");
  _builder.newLine();
  _newBuilder.append(_builder.toString()).assertProposalDisplayedAtCursor("equals(Object) - Override method from Object");
}
 
Example #30
Source File: XImportSectionContentAssistTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testMemberName() {
  try {
    final ContentAssistProcessorTestBuilder builder = this.newBuilder().append("import static org.eclipse.xtend.ide.tests.data.contentassist.Foo.").assertTextAtCursorPosition("Foo.", "Foo.".length(), "publicStaticMethod", "publicStaticField");
    builder.applyProposal("publicStaticMethod").expectContent("import static org.eclipse.xtend.ide.tests.data.contentassist.Foo.publicStaticMethod");
    builder.applyProposal("publicStaticField").expectContent("import static org.eclipse.xtend.ide.tests.data.contentassist.Foo.publicStaticField");
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}