use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class ScalaAutocompleteTest method autocomplete_multiLineOffsetCorrect.
@Test
public void autocomplete_multiLineOffsetCorrect() throws Exception {
// when
AutocompleteResult autocomplete = scalaEvaluator.autocomplete("val x = 3\nval numbers = Li", 26);
// then
Assertions.assertThat(autocomplete.getMatches()).isNotEmpty();
Assertions.assertThat(autocomplete.getStartIndex()).isEqualTo(24);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class ScalaAutocompleteTest method autocomplete_interpretedResultsVisible.
@Test
public void autocomplete_interpretedResultsVisible() {
// This test needs a fresh ScalaEvaluator to modify without disturbing other tests
final ScalaEvaluator localEvaluator = new ScalaEvaluator("id", "sid", null, cellExecutor(), new NoBeakerxObjectTestFactory(), getTestTempFolderFactory(), EvaluatorTest.KERNEL_PARAMETERS);
try {
// when
localEvaluator.evaluate(new SimpleEvaluationObject(""), "val xyzzy = 32");
AutocompleteResult autocomplete = localEvaluator.autocomplete("xyz", 3);
// then
Assertions.assertThat(autocomplete.getMatches()).isNotEmpty();
} finally {
localEvaluator.exit();
}
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class ScalaAutocompleteTest method autocomplete_namespaceShouldNotBeModified.
@Test
public void autocomplete_namespaceShouldNotBeModified() {
final String input1 = "val xyzzy = 32\nval xyz";
// when
AutocompleteResult autocomplete1 = scalaEvaluator.autocomplete(input1, input1.length());
AutocompleteResult autocomplete2 = scalaEvaluator.autocomplete("xyz", 3);
// then
Assertions.assertThat(autocomplete2.getMatches()).isEmpty();
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class ClojureAutocompleteTest method autocomplete_autocompleteResultNotEmpty.
@Test
public void autocomplete_autocompleteResultNotEmpty() throws Exception {
// when
AutocompleteResult autocomplete = clojureEvaluator.autocomplete("def", 3);
// then
Assertions.assertThat(autocomplete.getMatches()).isNotEmpty();
Assertions.assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class JavaEvaluatorAutocompleteClassNameExpressionTest method autocompleteToClassWithPackage.
@Test
public void autocompleteToClassWithPackage() throws Exception {
String code = "SimpleDateFor f = new java.text.SimpleDateFor";
// when
AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 13);
}
Aggregations