[antlr-interest] ANTLR and Unit Testing
Martin Probst
mail at martin-probst.com
Tue Apr 4 03:03:01 PDT 2006
> Maybe you can test the lexer and the parser together, but I would
> suggest that you consider testing one on top of the other. I.e, test the
> lexer and parser, then the treewalker(s), then the code generation.
>
> IMHO, there should be a set of tests for each phase. Granted, it might
> be a bit tedious but you will thank yourself in the long run.
It's actually most likely that testing the whole thing at once will turn
out to be more tedious in the long run. If a change introduces a bug in
the lexical/parser/treewalker stage, you'd want to see those tests
failing, but if the bug is actually in the translation or interpretation
stage, you'll know quickly because the lexing & parsing tests are not
failing. Also, it can be very difficult to test for certain
functionality if you conduct end-to-end tests (instead of unit tests).
This said, you still need end-to-end tests anyways.
Martin
More information about the antlr-interest
mailing list