Package test.shell.sync

Examples of test.shell.sync.SyncCompleter


    doTest();
  }

  private void doTest() {
    final AtomicReference<String> completions = new AtomicReference<String>();
    shell.setCompleter(new SyncCompleter() {
      @Override
      public CompletionMatch complete(String prefix) {
        completions.set(prefix);
        return null;
      }
View Full Code Here


    console.on(KeyStrokes.ENTER);
    console.on(KeyStrokes.b);
  }

  public void testCompleteEmpty() {
    shell.setCompleter(new SyncCompleter() {
      @Override
      public CompletionMatch complete(String prefix) {

        return null;
      }
View Full Code Here

    console.on(KeyStrokes.COMPLETE);
    driver.assertEmpty();
  }

  public void testCompleteSingle1() {
    shell.setCompleter(new SyncCompleter() {
      @Override
      public CompletionMatch complete(String prefix) {
        Completion.Builder builder = Completion.builder("");
        builder.add("foo", false);
        return new CompletionMatch(Delimiter.EMPTY, builder.build());
View Full Code Here

    driver.assertChars("foo").assertFlush().assertEmpty();
    assertEquals("foo", getCurrentLine());
  }

  public void testCompleteSingle2() {
    shell.setCompleter(new SyncCompleter() {
      @Override
      public CompletionMatch complete(String prefix) {
        Completion.Builder builder = Completion.builder("");
        builder.add("foo", true);
        return new CompletionMatch(Delimiter.EMPTY, builder.build());
View Full Code Here

    driver.assertChars("foo").assertChar(' ').assertFlush().assertEmpty();
    assertEquals("foo ", getCurrentLine());
  }

  public void testCompleteMulti1() {
    shell.setCompleter(new SyncCompleter() {
      @Override
      public CompletionMatch complete(String prefix) {
        Completion.Builder builder = Completion.builder("");
        builder.add("foo", false);
        builder.add("bar", false);
View Full Code Here

    driver.assertChars("\nfoo  bar  \n% ").assertFlush().assertEmpty();
    assertEquals("", getCurrentLine());
  }

  public void testCompleteMulti2() {
    shell.setCompleter(new SyncCompleter() {
      @Override
      public CompletionMatch complete(String prefix) {
        Completion.Builder builder = Completion.builder("");
        builder.add("afoo", false);
        builder.add("abar", false);
View Full Code Here

    console.on(KeyStrokes.ENTER);
    assertEquals(Arrays.asList("a\"\nb\nc\"d"), requests);
  }

  public void testCompleteMultiline() {
    shell.setCompleter(new SyncCompleter() {
      @Override
      public CompletionMatch complete(String prefix) {
        Completion.Builder builder = Completion.builder("s");
        if (prefix.equals("s")) {
          builder.add("end", true);
View Full Code Here

TOP

Related Classes of test.shell.sync.SyncCompleter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.