1 19 20 package org.netbeans.lib.html.lexer; 21 22 import junit.framework.TestCase; 23 import org.netbeans.api.lexer.TokenHierarchy; 24 import org.netbeans.api.lexer.TokenSequence; 25 import org.netbeans.lib.lexer.test.LexerTestUtilities; 26 import org.netbeans.modules.el.lexer.api.ELTokenId; 27 28 33 public class ELLexerBatchTest extends TestCase { 34 35 public ELLexerBatchTest(String testName) { 36 super(testName); 37 } 38 39 protected void setUp() throws java.lang.Exception { 40 LexerTestUtilities.setTesting(true); 42 } 43 44 protected void tearDown() throws java.lang.Exception { 45 } 46 47 public void testExpressions() { 48 String text = "session"; 49 TokenSequence ts = TokenHierarchy.create(text, ELTokenId.language()).tokenSequence(); 50 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.IDENTIFIER, "session"); 51 52 text = "(6 * 0x5) + 05"; 53 ts = TokenHierarchy.create(text, ELTokenId.language()).tokenSequence(); 54 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.LPAREN, "("); 55 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.INT_LITERAL, "6"); 56 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.WHITESPACE, " "); 57 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.MUL, "*"); 58 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.WHITESPACE, " "); 59 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.HEX_LITERAL, "0x5"); 60 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.RPAREN, ")"); 61 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.WHITESPACE, " "); 62 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.PLUS, "+"); 63 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.WHITESPACE, " "); 64 LexerTestUtilities.assertNextTokenEquals(ts, ELTokenId.OCTAL_LITERAL, "05"); 65 66 67 } 68 69 } 70 | Popular Tags |