Hello all,
simple question: Is it possible to test a tree walkers template output
using
gUnit? In my tree grammar I put the following into the starting rule:
@init {
try {
FileReader groupFileR = new FileReader("path/to/group.stg");
StringTemplateGroup templates = new
StringTemplateGroup(groupFileR);
groupFileR.close();
this.setTemplateLib(templates);
} /... some catch blocks
}
Of cause, I also added the imports. My testsuite looks as follows:
gunit TreeWalker walks Parser;
program walks program:
"if(true){}" OK
This TC fails. When I expect some value, like
program walks program:
"if(true){}" -> <<
if True:
pass
>>
I got the following output:
test1 (program walks program, line9) -
expected: if(true)
actual: java.lang.NullPointerException
Why does this NullPointerException occurs? I debugged into the
StringTemplate code but found nothing useful. I think it's produced
when performing the "node to template" transformation.
When I use the usual way to run the parser and walker, the input
"if(true){}" produces the expected "if True:\n pass". So I think the
issue is not caused by my grammars.
Wiki page http://www.antlr.org/wiki/display/ANTLR3/gUnit+-+Grammar+Unit+Testing
points out that testing template output is possible (see section "Test
StringTemplate output").
Thanks in advance.
Kind regards,
Chris
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---