[antlr-interest] Gunit 3.4 incorrectly failing test due to bug
Kieran Simpson
kierans777 at gmail.com
Wed Oct 26 03:33:53 PDT 2011
I'm starting to write my grammar so am setting up the build/tests. I'm
fetching gunit-3.4 via Apache Ivy, and am using the tools ability to
generate JUnit classes so that our reporting tools can run over the results.
My grammar consists of:
grammar CoreConfiguration;
SCOPE_BEGIN: '{';
SCOPE_END: '}';
WS: ( ' ' | '\t' | '\r' | '\n') {$channel=HIDDEN;};
configuration
: SCOPE_BEGIN SCOPE_END;
My Gunit test case is:
gunit CoreConfiguration;
//------------------- configuration
configuration:
"{ }" OK
"{ ]" FAIL
I translate the gunit file to JUnit using the -o switch of the
org.antlr.gunit.Interp class and compile the code. Upon running the
test I get the following output:
[junit] testing rule configuration expected:<OK> but was:<FAIL, >
[junit] junit.framework.AssertionFailedError: testing rule
configuration expected:<OK> but was:<FAIL, >
Looking through the gunit source, I've tracked the problem to the
gUnitBaseTest::examineExecResult() method on line 467. It's checking
whether the member variable 'stderr' is null and if not returns the
concatenation of "FAIL" and the contents ie:
return "FAIL, "+this.stderr;
However it appears that this.stderr is being set to empty on line 242,
so my test(s) will always fail. This is a bug.
Cheers,
More information about the antlr-interest
mailing list