[antlr-interest] gUnit: Some suggestions

Sumanto Biswas sumanto at gmail.com
Wed Jul 2 10:53:07 PDT 2008


Hi,

I have been using gUnit 1.0.2 with antlr 3.1b1 and it has helped me in
automating test cases, specially positive ones a lot. Thanks for
developing a unit test framework for antlr !!

I have a few suggestions:
1. Add debug option which when set can print some debug info, like:
   > Start/End execution of each test case with i/p string, rule name etc,
   > Lexer and parser classes being used.
2. Should not exit on InvocationTargetException. Presently code does
"System.setErr(consoleErr); e.printStackTrace(); System.exit(1);".
Since I have set test-case to FAIL anyways, and the exception wraps
MismatchedTokenException, I would want to continue with test case
processing. Stack trace pasted below for reference.
3. Ability to check and match for Exception and messages. e.g. '"a = 4
+- 5" FAIL::Exception::message

Regards,
Sumanto

--------------------------------------------------------------------------
java.lang.reflect.InvocationTargetException
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.antlr.gunit.gUnitExecuter.runParser(gUnitExecuter.java:239)
	at org.antlr.gunit.gUnitExecuter.runCorrectParser(gUnitExecuter.java:131)
	at org.antlr.gunit.gUnitExecuter.executeTests(gUnitExecuter.java:149)
	at org.antlr.gunit.gUnitExecuter.execTest(gUnitExecuter.java:96)
	at org.antlr.gunit.Interp.main(Interp.java:62)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: MismatchedTokenException(-1!=27)
	at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:630)
	at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:117)
	at soslParser.searchSpec(soslParser.java:933)
	at soslParser.sosl(soslParser.java:298)
	... 13 more
--------------------------------------------------------------------------


More information about the antlr-interest mailing list