use of org.eclipse.xtext.testing.DocumentSymbolConfiguraiton in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testDocumentSymbol.
protected void testDocumentSymbol(final Procedure1<? super DocumentSymbolConfiguraiton> configurator) {
try {
@Extension final DocumentSymbolConfiguraiton configuration = new DocumentSymbolConfiguraiton();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
DocumentSymbolParams _documentSymbolParams = new DocumentSymbolParams(_textDocumentIdentifier);
final CompletableFuture<List<? extends SymbolInformation>> symbolsFuture = this.languageServer.documentSymbol(_documentSymbolParams);
final List<? extends SymbolInformation> symbols = symbolsFuture.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.DocumentSymbolConfiguraiton in project xtext-core by eclipse.
the class DocumentSymbolTest method testDocumentSymbol_01.
@Test
public void testDocumentSymbol_01() {
final Procedure1<DocumentSymbolConfiguraiton> _function = (DocumentSymbolConfiguraiton 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());
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("\t");
_builder_1.append("container: \"Foo\"");
_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("\t");
_builder_1.append("container: \"Foo.bar\"");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
_builder_1.append("symbol \"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 [[3, 5] .. [3, 8]]");
_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("\t");
_builder_1.append("container: \"Bar\"");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
it.setExpectedSymbols(_builder_1.toString());
};
this.testDocumentSymbol(_function);
}
Aggregations