This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Provide unit testing framework for lexer | ||
---|---|---|---|
Product: | editor | Reporter: | Jesse Glick <jglick> |
Component: | Lexer | Assignee: | Miloslav Metelka <mmetelka> |
Status: | NEW --- | ||
Severity: | blocker | CC: | jtulach, mfukala, vstejskal |
Priority: | P2 | Keywords: | TEST |
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
Jesse Glick
2006-10-14 12:46:45 UTC
Currently there is only a support for randomized testing in org.netbeans.lib.lexer.test.TestRandomModify that allows to specify the probability for specific chars and strings but it only compares the incrementally updated token list with a batch lexed one. It does not check the proper identity of the individual tokens. It's true that with the declarative stuff the tests like e.g. JavaLexerBatchTest could become more terse and could be written more quickly so I like this idea. Some time ago I've made LexerTestUtilities.checkTokenDump() that gets an input file as parameter and produces a text output describing the created tokens from the input (please see the javadoc of the method). The output is written to a file in the same directory with "tokens.txt" appended if such file does not exist yet and the test fails notifying the user that the file was created (user should check whether the produced tokens match expectations). If the output file already exists its content is compared against the produced output and the test would fail if the contents would not be exactly the same. As I was coding it I have added some features like multiple inputs (virtual EOFs), test naming and special chars. I'm using extra lines for control sequences and interleave the directives with dots to distinguish them from regular input. The input specification could be rewritten to xml if desirable. Please see in lexer: TokenDumpTest, TokenDumpTestFile.txt (for control directives) and in java/lexer: JavaTokenDumpTest and testInput.java.txt and testInput.java.txt.tokens.txt for using it to test java lexer correctness. If this would suffice I would then close this issue. |