[antlr-interest] announcing gUnit: ANTLR grammar unit testing / gUnit grammar updated

Leon Su leonsu at msn.com
Mon Aug 20 12:05:40 PDT 2007


Hi,
please download the new version of gUnit on wiki first, then try this new syntax of gUnit: (the following script is based on your testsuite)

gunit On;
@header{xy.object.notation;}
your testsuites...

Now, it should work on the grammar using package :)

Leon
Date: Sat, 18 Aug 2007 16:45:21 +0800
From: fyaoxy at gmail.com
To: leonsu at msn.com; antlr-interest at antlr.org
Subject: Re: [antlr-interest] announcing gUnit: ANTLR grammar unit testing

Hi,
I change gUnit.g heading grammar as follows:

gUnitDef:    'gunit' g1=target
    {interpreter.grammarName = $g1.text;} 
    (
    'walks' g2=target
    {interpreter.grammarName =  $g2.text;}

    )? ';' 
        header? suite+ ;
target    :    ID EXT*; //TODO: make a choid between lexer and parser.

and in my target grammar:

grammar On;
@header{package xy.object.notation;}

@lexer::header{package xy.object.notation;}

and my grammar gUnit testsuite:

gunit xy.object.notation.On;

It works fine.
But there is question I not sure, that is just that TODO:
target    :    ID EXT*; //TODO: make a choid between lexer and parser.

I not sure which way is the best.



2007/8/18, Leon Su <leonsu at msn.com>:




Hi,

Thanks for your trying and the suggestions. 
I'll consider your points for improving the tool :)

Leon
Date: Fri, 17 Aug 2007 07:01:57 +0800

From: fyaoxy at gmail.com
To: 
antlr-interest at antlr.org
Subject: Re: [antlr-interest] announcing gUnit: ANTLR grammar unit testing

Wawo, so great!  gunit so pretty!
I tried, all passed. it make me happy.


gunit On;

words:
"h" OK
"hello" OK
"hello " OK
"hello world" OK
"hello world " OK

"hello world     " OK
" hello world " OK
"hello " -> "hello"
"hello world" -> "hello world"
"hello world    " -> "hello world"

"    hello world    " -> "hello world"

name:
"hello,world" OK
"hello,world" ->"(NAME (TSTRING hello) (TSTRING world))"
" hello ,    world " ->"(NAME (TSTRING hello) (TSTRING world))"


<<" hello
world ">> -><<(NAME (TSTRING  hello
world ))>>

though my last test infinite loop:)

And I have idea: 
I
use package name in my grammar, current gunit just take grammar name.
so do a hard code in it, I would like to deep into this tool.

I wanna enhance testcase with additional message, like I do before:
/*string test*/
//valid single test
a
1
\n
word
张三
//invalid single test
,
"

{
}
:
//valid multiple test

a aaaa
123 abc
123 abc 
//quoted test
"abc1"

seems "input ouput" triple can be done "message input output" or "input output message"
even:
group message{

test 
test
}

Thank you again:)


2007/8/16, Terence Parr <parrt at cs.usfca.edu
>:
Howdy.  Martin Bravenboer gave me a look at his nice grammar testing
facilities for a GLR-based parser generator (ASF+SDF) at OOPSLA last
year.  He inspired me to build one for ANTLR.  Fortunately, I found a
very capable graduate student, Leon Su, that was able to implement it

this summer.  Here is the wiki with code attached. :)

http://www.antlr.org/wiki/display/ANTLR3/gUnit+-+Grammar+Unit+Testing



Please direct feedback to the group and/or Leon so we can improve
it.  I think you'll find it is a very nice tool.  Has both
interpreted and gUnit->jUnit code gen modes. :)

Terence




-- 
致敬
向秦贤



-- 
致敬
向秦贤
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070820/7c6d5ab9/attachment.html 


More information about the antlr-interest mailing list