use of org.eclipse.xtext.testing.HoverTestConfiguration in project xtext-core by eclipse.
the class HoverTest method testHover_03.
@Test
public void testHover_03() {
final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* Some documentation.");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("type Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("Foo foo");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(4);
it.setColumn("\tF".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[4, 1] .. [4, 4]]");
_builder_1.newLine();
_builder_1.append("Some documentation.");
_builder_1.newLine();
it.setExpectedHover(_builder_1.toString());
};
this.testHover(_function);
}
use of org.eclipse.xtext.testing.HoverTestConfiguration in project xtext-core by eclipse.
the class HoverTest method testHover_01.
@Test
public void testHover_01() {
final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* Some documentation.");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("type Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(3);
it.setColumn("type F".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[3, 5] .. [3, 8]]");
_builder_1.newLine();
_builder_1.append("Some documentation.");
_builder_1.newLine();
it.setExpectedHover(_builder_1.toString());
};
this.testHover(_function);
}
use of org.eclipse.xtext.testing.HoverTestConfiguration in project xtext-core by eclipse.
the class HoverTest method testHover_04.
@Test
public void testHover_04() {
final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* Some documentation.");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("type Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("type Bar extends Foo {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(5);
it.setColumn("type Bar extends F".length());
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("[[5, 17] .. [5, 20]]");
_builder_1.newLine();
_builder_1.append("Some documentation.");
_builder_1.newLine();
it.setExpectedHover(_builder_1.toString());
};
this.testHover(_function);
}
use of org.eclipse.xtext.testing.HoverTestConfiguration in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testHover.
protected void testHover(final Procedure1<? super HoverTestConfiguration> configurator) {
try {
@Extension final HoverTestConfiguration configuration = new HoverTestConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
it.setTextDocument(_textDocumentIdentifier);
int _line = configuration.getLine();
int _column = configuration.getColumn();
Position _position = new Position(_line, _column);
it.setPosition(_position);
};
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
final CompletableFuture<Hover> hoverFuture = this.languageServer.hover(_doubleArrow);
final Hover hover = hoverFuture.get();
Procedure1<? super Hover> _assertHover = configuration.getAssertHover();
boolean _tripleNotEquals = (_assertHover != null);
if (_tripleNotEquals) {
configuration.getAssertHover().apply(hover);
} else {
final String actualHover = this.toExpectation(hover);
this.assertEquals(configuration.getExpectedHover(), actualHover);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtext.testing.HoverTestConfiguration in project xtext-core by eclipse.
the class HoverTest method testHover_02.
@Test
public void testHover_02() {
final Procedure1<HoverTestConfiguration> _function = (HoverTestConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/**");
_builder.newLine();
_builder.append(" ");
_builder.append("* Some documentation.");
_builder.newLine();
_builder.append(" ");
_builder.append("*/");
_builder.newLine();
_builder.append("type Foo {}");
_builder.newLine();
it.setModel(_builder.toString());
it.setLine(3);
it.setColumn("{".length());
};
this.testHover(_function);
}
Aggregations