use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnResultEqualToParamString.
@Test
public void shouldReturnResultEqualToParamString() throws Exception {
String code = "def paramString = 'str'\n" + "println \"test ${par";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("paramString");
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method autocompleteMatchesForSystemAfterDot.
@Test
public void autocompleteMatchesForSystemAfterDot() throws Exception {
String code = "System.";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method shouldReturnResultEqualToToString.
@Test
public void shouldReturnResultEqualToToString() throws Exception {
String code = "def v = 'str'\nv.toS";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("toString");
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method autocompleteForClass_shouldReturnResultEqualToCoordinates.
@Test
public void autocompleteForClass_shouldReturnResultEqualToCoordinates() throws Exception {
String code = "class Coordinates {\n" + "double latitude\n" + "double longitude }\n" + "def coordinates = new Coordinates(latitude: 43.23, longitude: 3.67)\n" + "this.class.co";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches().get(0)).isEqualToIgnoringCase("coordinates");
}
use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.
the class GroovyEvaluatorAutocompleteTest method autocompleteToMethodsForImportedClassesSeparatedByNewLine.
@Test
public void autocompleteToMethodsForImportedClassesSeparatedByNewLine() throws Exception {
String code = "import com.twosigma.beakerx.mimetype.MIMEContainer\n" + "import groovy.json.JsonSlurper\n" + "def jsonSlurper = new JsonSlurper()\n" + "def json = jsonSlurper.";
// when
AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
// then
assertThat(autocomplete.getMatches()).isNotEmpty();
assertThat(autocomplete.getStartIndex()).isEqualTo(code.length());
}
Aggregations