use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method autocompleteToJavaPackage.
@Test
public void autocompleteToJavaPackage() throws Exception {
String code = "jav";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method autocompleteWithMagicCommands.
@Test
public void autocompleteWithMagicCommands() throws Exception {
String code = "%classpath add jar demoResources/BeakerXClasspathTest.jar\n" + "System.";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnEmptyResultForIncorrectCode.
@Test
public void shouldReturnEmptyResultForIncorrectCode() throws Exception {
String code = "]";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnResultEqualToParamArray.
@Test
public void shouldReturnResultEqualToParamArray() throws Exception {
String code = "def paramArray = [1, 3, 5]\n" + "println par";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramArray");
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnResultEqualToParamDouble.
@Test
public void shouldReturnResultEqualToParamDouble() throws Exception {
String code = "def paramDouble = 10.0\n" + "println par";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramDouble");
}
Aggregations