[antlr-interest] gUnitEditor does not handle *.gunit files with "@header {package my.pack.there; }" gracefully

Stefan Mätje (d) Stefan.Maetje at esd-electronics.com
Fri Nov 4 11:22:17 PDT 2011


Hi,

the gUnitEditor seems to be a nice tool but it doesn't handle *.gunit files 
with an included "@header {package my.pack.there;}" gracefully.

It is able to read such a file but when writing the "@header" line is 
discarded. I unpacked the antlr-3.4-complete.jar and patched the 
StringTemplate group file /org/antlr/gunit/swingui/gunit.stg to contain my 
needed header line like this:

------------------------------------------------------------
group gunit;

gUnitFile(testSuite) ::= <<gunit <testSuite.grammarName>;

@header { package my.pack.there.antlr; }
<testSuite.rulesForStringTemplate:testGroup()>
>>

testGroup() ::= <<
<if(it.notEmpty)>

//------------------- <it.name>
<it.name>:

<it.testCases: testCase(); separator="\n\n">

<endif>
>>

testCase() ::= "<it.input> <it.output>"
-------------------------------------------------------------

This way I can use this tool at least as a sophisticated editor for *.gunit 
files without destroying the package line over and over again.

But unfortunately the gUnitEditor is not able to run the unit tests because it 
doesn't find the lexer. I assume gUnitEditor needs to evaluate the @header 
line itself.

Running the tests on the command line from the same directory works.

Anybody out there keen on fixing this? I'm not doing it myself because I'm a 
Java newbie and I suspect I would more break than fix.

Greets,
	Stefan



More information about the antlr-interest mailing list