Search in sources :

Example 86 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class JavaEvaluatorAutocompleteClassNameExpressionTest method autocompleteToClassWithoutPackage.

@Test
public void autocompleteToClassWithoutPackage() throws Exception {
    String code = "Integer f = new Integ";
    // when
    AutocompleteResult autocomplete = evaluator().autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches().size()).isGreaterThan(0);
    assertThat(autocomplete.getMatches()).contains("Integer");
    assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 5);
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Test(org.junit.Test)

Example 87 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class GroovyEvaluatorAutocompleteClassNameExpressionTest method autocompleteCreateNewIntegerWithPackage.

@Test
public void autocompleteCreateNewIntegerWithPackage() throws Exception {
    String code = "new java.lang.Inte";
    // when
    AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches()).isNotEmpty();
    assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 4);
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Test(org.junit.Test)

Example 88 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class GroovyEvaluatorAutocompleteClassNameExpressionTest method autocompleteToIntegerClassWithPackage.

@Test
public void autocompleteToIntegerClassWithPackage() throws Exception {
    String code = "def f = new java.lang.Inte";
    // when
    AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches()).isNotEmpty();
    assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 4);
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Test(org.junit.Test)

Example 89 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class GroovyEvaluatorAutocompleteTest method defaultImportsAutocompleteToRED.

@Test
public void defaultImportsAutocompleteToRED() throws Exception {
    String code = "def colors = [ Color.RE";
    // when
    AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches()).isNotEmpty();
    assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 2);
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Test(org.junit.Test)

Example 90 with AutocompleteResult

use of com.twosigma.beakerx.autocomplete.AutocompleteResult in project beakerx by twosigma.

the class GroovyEvaluatorAutocompleteTest method autocompleteMatchesToRED.

@Test
public void autocompleteMatchesToRED() throws Exception {
    String code = "Color.R";
    // when
    AutocompleteResult autocomplete = groovyEvaluator.autocomplete(code, code.length());
    // then
    assertThat(autocomplete.getMatches()).isNotEmpty();
    assertThat(autocomplete.getStartIndex()).isEqualTo(code.length() - 1);
}
Also used : AutocompleteResult(com.twosigma.beakerx.autocomplete.AutocompleteResult) Test(org.junit.Test)

Aggregations

AutocompleteResult (com.twosigma.beakerx.autocomplete.AutocompleteResult)107 Test (org.junit.Test)102 Ignore (org.junit.Ignore)20 BaseEvaluator (com.twosigma.beakerx.evaluator.BaseEvaluator)10 Collectors (java.util.stream.Collectors)10 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)10 AfterClass (org.junit.AfterClass)10 BeforeClass (org.junit.BeforeClass)10 EvaluatorTest (com.twosigma.beakerx.evaluator.EvaluatorTest)6 KERNEL_PARAMETERS (com.twosigma.beakerx.evaluator.EvaluatorTest.KERNEL_PARAMETERS)6 EvaluatorTest.getTestTempFolderFactory (com.twosigma.beakerx.evaluator.EvaluatorTest.getTestTempFolderFactory)6 TestBeakerCellExecutor.cellExecutor (com.twosigma.beakerx.evaluator.TestBeakerCellExecutor.cellExecutor)6 JavaEvaluator (com.twosigma.beakerx.javash.evaluator.JavaEvaluator)6 KernelTest (com.twosigma.beakerx.KernelTest)4 AutocompleteCandidate (com.twosigma.beakerx.autocomplete.AutocompleteCandidate)4 TestGroovyEvaluator (com.twosigma.beakerx.groovy.TestGroovyEvaluator)4 ArrayList (java.util.ArrayList)4 ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)2 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)2 Lexer (org.antlr.v4.runtime.Lexer)2