use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.
the class Bug461923Test method test_04.
@Test
public void test_04() 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<? extends 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[]");
}
use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.
the class Bug461923Test method test_07.
@Test
public void test_07() 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(T[] arr, T value) {");
_builder.newLine();
_builder.append(" ");
_builder.append("ImmutableList.builder.addAll(arr.<|>filter[it != value]).build");
_builder.newLine();
_builder.append(" ");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_newBuilder.append(_builder.toString()).assertProposalAtCursor("filter[]");
}
use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.
the class Bug461923Test method test_03.
@Test
public void test_03() 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<? super 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[]");
}
use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.
the class Bug462915Test method testAdditionalProposalInfoWorks.
/**
* make sure additional proposal infos can be calculated
*/
@Test
public void testAdditionalProposalInfoWorks() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class A {");
_builder.newLine();
_builder.append("\t");
_builder.append("test");
_builder.newLine();
_builder.append("}");
final String model = _builder.toString();
ContentAssistProcessorTestBuilder _append = this.newBuilder().append(model);
int _indexOf = model.indexOf("test");
int _plus = (_indexOf + 4);
final ICompletionProposal[] proposals = _append.computeCompletionProposals(_plus);
Assert.assertEquals("More than one proposal found", 1, ((List<ICompletionProposal>) Conversions.doWrapArray(proposals)).size());
final ICompletionProposal proposal = IterableExtensions.<ICompletionProposal>head(((Iterable<ICompletionProposal>) Conversions.doWrapArray(proposals)));
Assert.assertEquals("test - JUnit test method", proposal.getDisplayString());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("@Test");
_builder_1.newLine();
_builder_1.append("def void testName() {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.newLine();
_builder_1.append("}");
Assert.assertEquals(_builder_1.toString(), proposal.getAdditionalProposalInfo());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.ui.testing.ContentAssistProcessorTestBuilder in project xtext-xtend by eclipse.
the class JavaDocContentAssistTest method testTypeInJavaDoc.
@Test
public void testTypeInJavaDoc() {
try {
ContentAssistProcessorTestBuilder _newBuilder = this.newBuilder();
StringConcatenation _builder = new StringConcatenation();
_builder.append("package foo");
_builder.newLine();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* @see java.util.Dat");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("class Foo {}");
_builder.newLine();
ContentAssistProcessorTestBuilder _applyProposal = _newBuilder.append(_builder.toString()).assertTextAtCursorPosition(37, "java.util.Date").applyProposal(37);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package foo");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("import java.util.Date");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("/**");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("* @see Date");
_builder_1.newLine();
_builder_1.append(" ");
_builder_1.append("*/");
_builder_1.newLine();
_builder_1.append("class Foo {}");
_builder_1.newLine();
_applyProposal.expectContent(_builder_1.toString());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations