[antlr-interest] JUnit testing of ASTs

Rodrigo B. de Oliveira rodrigobamboo at gmail.com
Tue Dec 21 10:57:56 PST 2004


That's the exact approach I used in boo and I really like the way it works.

The only significant difference is that the expected output is
embedded in the test file (the one to be parsed) as a docstring:

<this is a test file>
"""
a = 'Hello!'
print a
"""
a = "Hello"
print a
</this is a test file>

The build generates the actual nunit test fixture class by looking in
a specific directory for test files. That way, adding a new test case
is as simple as "Save As...".

Best wishes,
Rodrigo

On Tue, 21 Dec 2004 10:20:37 -0800 (PST), Paul J. Lucas
<pauljlucas at mac.com> wrote:
>         Does anybody do JUnit regression testing on their parsers?  If
>         so, how, exactly?
> 
>         For lack of anything better, *a* way of doing it is to have a
>         set of files to parse and the pretty-printed output of the
>         expected ASTs.  Then, when you run the tests, simply diff their
>         output with the expected output.
> 
>         Anything better?
> 
>         - Paul
>


More information about the antlr-interest mailing list