[antlr-interest] Questions about gUnit
Leon Su
leon.antlr at mac.com
Mon Aug 25 06:00:28 PDT 2008
Hi Yuri,
As for your first question, gUnit receives output string "stringabc
\n" from System.out.println("stringabc").
so try this:
rule1:
"stringabc" -> "stringabc\n"
In addition, current version of gUnit is not able to test the rule
with arguments. I have plans to make gUnit be able to test this part
including grammar actions under jUnit translation mode.
Leon
On Aug 21, 2008, at 10:11 PM, Yuri Tijerino wrote:
> Hi,
>
> I have a couple of questions about gUnit. One is posted at:
> http://www.jguru.com/forums/view.jsp?EID=1368630
>
> the other one is as follows:
>
> How do you run gUnit tests on rules that take arguments such as:
>
> rule [type arg]
> :
> << some code that uses arg >>
> ;
>
> I tried this by including the rule as follows in the
> GrammarName.testsuite file
>
> rule:
> "test1" OK
>
> I also tried:
>
> rule [arg]:
> "test1" OK
>
> and
>
> rule(arg):
> "test1" OK
>
> But java complains that GrammarNameParser.rule() does not exists as
> follows:
>
> java.lang.NoSuchMethodException: GrammarNameParser.rule()
>
> If I comment out the argument in the grammar file as follows:
>
>
> rule //[type arg]
> :
> << some code that does not use arg >>
> ;
>
> then the tests seem to go fine.
>
> What is the correct way to run tests on rules with arguments?
>
> Yuri Tijerino
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-
> interest/your-email-address
>
More information about the antlr-interest
mailing list