[antlr-interest] Gunit 3.4 incorrectly failing test due to bug

Kieran Simpson kierans777 at gmail.com
Sun Oct 30 19:18:54 PDT 2011


In case anyone else is having this problem, I've attached a patch with a 
fix for the head version of the file (rev 7313).  Hopefully this can be 
incorporated into the official build soon.

Cheers,


On 23/07/64 5:59 AM, Kieran Simpson wrote:
> 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,
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gUnitBaseTest.java.patch
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20111031/d9b50cbc/attachment.pl 


More information about the antlr-interest mailing list