MCPcopy Create free account
hub / github.com/apache/pig / TestLexer

Method TestLexer

test/org/apache/pig/parser/TestQueryLexer.java:32–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30public class TestQueryLexer {
31
32 @Test
33 public void TestLexer() throws IOException {
34 CharStream input = new QueryParserFileStream( "test/org/apache/pig/parser/TestLexer.pig" );
35 QueryLexer lexer = new QueryLexer( input );
36 int tokenCount = 0;
37 Token token;
38 while( ( token = lexer.nextToken() ).getType() != Token.EOF ) {
39 if( token.getChannel() == Token.HIDDEN_CHANNEL )
40 continue;
41 tokenCount++;
42 if( token.getText().equals( ";" ) ) {
43 System.out.println( token.getText() );
44 } else {
45 System.out.print( token.getText() + "(" + token.getType() + ") " );
46 }
47 }
48
49 // While we can check more conditions, such as type of each token, for now I think the following
50 // is enough. If the token type is wrong, it will be most likely caught by the parser.
51 Assert.assertEquals( 455, tokenCount );
52 Assert.assertEquals( 0, lexer.getNumberOfSyntaxErrors() );
53 }
54
55 @Test
56 public void test2() throws IOException {

Callers

nothing calls this directly

Calls 4

getTypeMethod · 0.65
equalsMethod · 0.45
printMethod · 0.45
assertEqualsMethod · 0.45

Tested by

no test coverage detected