Package com.google.jstestdriver.token

Examples of com.google.jstestdriver.token.BufferedTokenStream


        new BufferedInputStream(
            new ByteArrayInputStream((tokens[0].toString()
                                      + tokens[1].toString()
                                      + tokens[2].toString()
                                      + tokens[3].toString()).getBytes()));
    BufferedTokenStream lexer = new HtmlDocLexer().createStream(stream);
    for (Token token : expected) {
      assertEquals(token, lexer.read());
    }
    assertFalse(lexer.available());
  }
View Full Code Here


    BufferedInputStream stream =
      new BufferedInputStream(
        new ByteArrayInputStream((tokens[0].toString()
            + otherOne.toString() + tokens[1].toString()).getBytes()));

    BufferedTokenStream lexer = new HtmlDocLexer().createStream(stream);
    List<Token> expected =
        Lists.newArrayList(tokens[0], otherOne, tokens[1]);
    for (Token token : expected) {
      assertEquals(token, lexer.read());
    }
  }
View Full Code Here

        new ByteArrayInputStream(("TestCase.prototype.setUp = function(){"
                                  + "  this.foo = 1;"
                                  + "  /*:DOC bar = <div></div>*/"
                                  + "};").getBytes()));
   
    BufferedTokenStream lexer = new HtmlDocLexer().createStream(stream);
    List<Token> expected = Lists.newArrayList(
      ConcreteToken.from("TestCase.prototype.setUp "),
      ConcreteToken.from("="),
      ConcreteToken.from(" function()"),
      ConcreteToken.from("{"),
      ConcreteToken.from("  this.foo "),
      tokens[3],
      ConcreteToken.from(" 1;  "),
      tokens[0],
      ConcreteToken.from(" bar "),
      ConcreteToken.from("="),
      ConcreteToken.from(" <div></div>"),
      tokens[1],
      tokens[4]);
    for (Token token : expected) {
      assertEquals(token, lexer.read());
    }
  }
View Full Code Here

    BufferedInputStream stream =
      new BufferedInputStream(
        new ByteArrayInputStream((tokens[2].toString()
            + otherOne.toString() + tokens[1].toString() + tokens[3].toString()).getBytes()));
   
    BufferedTokenStream lexer = new HtmlDocLexer().createStream(stream);
    List<Token> expected =
      Lists.newArrayList(tokens[2], otherOne, tokens[1], tokens[3]);
    for (Token token : expected) {
      assertEquals(token, lexer.read());
    }
  }
View Full Code Here

                                       new ConcreteToken("3".toCharArray()),
                                       new ConcreteToken("4".toCharArray()));
  }
 
  public void testRead() throws Exception {
    BufferedTokenStream stream = new BufferedTokenStream(tokens.iterator());
    assertEquals(tokens.get(0), stream.read());
  }
View Full Code Here

    BufferedTokenStream stream = new BufferedTokenStream(tokens.iterator());
    assertEquals(tokens.get(0), stream.read());
  }

  public void testReadReset() throws Exception {
    BufferedTokenStream stream = new BufferedTokenStream(tokens.iterator());
    assertEquals(tokens.get(0), stream.read());
    stream.reset();
    assertEquals(tokens.get(0), stream.read());
  }
View Full Code Here

    stream.reset();
    assertEquals(tokens.get(0), stream.read());
  }
 
  public void testReadMarkReset() throws Exception {
    BufferedTokenStream stream = new BufferedTokenStream(tokens.iterator());
    assertEquals(tokens.get(0), stream.read());
    assertEquals(tokens.get(1), stream.read());
    stream.mark();
    assertEquals(tokens.get(2), stream.read());
    assertEquals(tokens.get(3), stream.read());
    stream.reset();
    assertEquals(tokens.get(2), stream.read());
  }
View Full Code Here

    stream.reset();
    assertEquals(tokens.get(2), stream.read());
  }
 
  public void testReadEndOfStream() throws Exception {
    BufferedTokenStream stream = new BufferedTokenStream(Lists.<Token>newArrayList().iterator());
    assertEquals(null, stream.read());
  }
View Full Code Here

    BufferedTokenStream stream = new BufferedTokenStream(Lists.<Token>newArrayList().iterator());
    assertEquals(null, stream.read());
  }
 
  public void testReadAvailable() throws Exception {
    BufferedTokenStream stream = new BufferedTokenStream(tokens.iterator());
    assertEquals(tokens.get(0), stream.read());
    assertEquals(tokens.get(1), stream.read());
    assertTrue(stream.available());
    stream.mark();
    assertTrue(stream.available());
    assertEquals(tokens.get(2), stream.read());
    assertEquals(tokens.get(3), stream.read());
    assertFalse(stream.available());
    assertNull(stream.read());
    stream.reset();
    assertTrue(stream.available());
  }
View Full Code Here

        htmlTokenTwo,
        endDocToken);
    Nodes nodes = new Nodes();
    new HtmlDocNodeFactory(
        new HtmlDocNestedNode.NestedNodeStrategy()).create(
            new BufferedTokenStream(tokens.iterator()), nodes);
   
    assertEquals(new Nodes().add(new HtmlDocNestedNode(barToken,
      Lists.newArrayList(htmlTokenOne, equalsToken, htmlTokenTwo))),
        nodes);
  }
View Full Code Here

TOP

Related Classes of com.google.jstestdriver.token.BufferedTokenStream

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.