use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnImplements.
@Test
public void shouldReturnImplements() throws Exception {
String code = "class Coordinates implemen";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualTo("implements");
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 8);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldAutocompleteWithAsterisk.
@Test
public void shouldAutocompleteWithAsterisk() throws Exception {
String code = "import java.awt.*\n" + "println Color.B";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 1);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnPrintlnForFirstLine.
@Test
public void shouldReturnPrintlnForFirstLine() throws Exception {
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete("System.out.printl\n" + "System.out.print\n" + "System.out.prin\n" + "System.out.pri\n", 17);
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(11);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnExtends.
@Test
public void shouldReturnExtends() throws Exception {
String code = "class Coordinates exten";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualTo("extends");
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 5);
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method autocompleteToList.
@Test
public void autocompleteToList() throws Exception {
String code = "Li";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(0);
}
Aggregations