use of org.eclipse.xtext.testing.WorkspaceSymbolConfiguration in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testSymbol.
protected void testSymbol(final Procedure1<? super WorkspaceSymbolConfiguration> configurator) {
try {
@Extension final WorkspaceSymbolConfiguration configuration = new WorkspaceSymbolConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
this.initializeContext(configuration);
String _query = configuration.getQuery();
WorkspaceSymbolParams _workspaceSymbolParams = new WorkspaceSymbolParams(_query);
final List<? extends SymbolInformation> symbols = this.languageServer.symbol(_workspaceSymbolParams).get();
Procedure1<? super List<? extends SymbolInformation>> _assertSymbols = configuration.getAssertSymbols();
boolean _tripleNotEquals = (_assertSymbols != null);
if (_tripleNotEquals) {
configuration.getAssertSymbols().apply(symbols);
} else {
final String actualSymbols = this.toExpectation(symbols);
this.assertEquals(configuration.getExpectedSymbols(), actualSymbols);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.testing.WorkspaceSymbolConfiguration in project xtext-core by eclipse.
the class WorkspaceSymbolTest method testSymbol_01.
@Test
public void testSymbol_01() {
final Procedure1<WorkspaceSymbolConfiguration> _function = (WorkspaceSymbolConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("type Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("int bar");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("type Bar {");
_builder.newLine();
_builder.append("\t");
_builder.append("Foo foo");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
it.setQuery("F");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("symbol \"Foo\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[0, 5] .. [0, 8]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("symbol \"Foo.bar\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[1, 5] .. [1, 8]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("symbol \"Foo.bar.int\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[1, 1] .. [1, 4]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("symbol \"Bar.foo\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[4, 5] .. [4, 8]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
it.setExpectedSymbols(_builder_1.toString());
};
this.testSymbol(_function);
}
use of org.eclipse.xtext.testing.WorkspaceSymbolConfiguration in project xtext-core by eclipse.
the class WorkspaceSymbolTest method testSymbol_02.
@Test
public void testSymbol_02() {
final Procedure1<WorkspaceSymbolConfiguration> _function = (WorkspaceSymbolConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("type Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("int bar");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("type Bar {");
_builder.newLine();
_builder.append("\t");
_builder.append("Foo foo");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
it.setQuery("oO");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("symbol \"Foo\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[0, 5] .. [0, 8]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("symbol \"Foo.bar\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[1, 5] .. [1, 8]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("symbol \"Foo.bar.int\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[1, 1] .. [1, 4]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("symbol \"Bar.foo\" {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("kind: 7");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("location: MyModel.testlang [[4, 5] .. [4, 8]]");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
it.setExpectedSymbols(_builder_1.toString());
};
this.testSymbol(_function);
}
Aggregations