()
| 30 | public 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 { |
nothing calls this directly
no test coverage detected