[antlr-interest] ANTLR and Unit Testing

Sohail Somani sohail at taggedtype.net
Mon Apr 3 19:21:51 PDT 2006


On Mon, 2006-04-03 at 19:49 -0400, Scott Amort wrote:
> Rodrigo B. de Oliveira wrote:
> > On 4/1/06, Scott Amort <jsamort at rogers.com> wrote:
> > http://boo.codehaus.org/Writing+Tests
> 
> Thanks for the link, and thanks to Sohail as well for his response.
> 
> Is it correct to generalize then that most tests are conducted with the 
> lexer/parser/treewalker as a whole (i.e. compile an input and compare 
> the output with what you expect to get), instead of more focused tests 
> at the individual class or function level?  Please forgive the possible 
> naievity of the question, I'm quite new to the notion of unit testing.

No, I'm sorry if I gave you that impression.

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.

Sohail



More information about the antlr-interest mailing list