Merge pull request #11 from sharwell/clean-tests

Clean tests
This commit is contained in:
Terence Parr 2012-02-13 15:38:39 -08:00
commit 7b672c31da
2 changed files with 8 additions and 2 deletions

View File

@ -303,6 +303,7 @@ public class CodeGenerator {
* TListener.java, if we're using the Java target.
*/
public String getListenerFileName() {
assert g.name != null;
ST extST = templates.getInstanceOf("codeFileExtension");
String listenerName = g.name + "Listener";
return listenerName+extST.render();
@ -312,6 +313,7 @@ public class CodeGenerator {
* such as BlankTListener.java, if we're using the Java target.
*/
public String getBlankListenerFileName() {
assert g.name != null;
ST extST = templates.getInstanceOf("codeFileExtension");
String listenerName = "Blank" + g.name + "Listener";
return listenerName+extST.render();

View File

@ -42,10 +42,14 @@ public class TestCompositeGrammars extends BaseTest {
String grammar =
"parser grammar S;\n" +
"a : B . C ;\n"; // not qualified ID
Grammar g = new Grammar(grammar);
mkdir(tmpdir);
Grammar g = new Grammar(tmpdir + "/S.g", grammar);
g.name = "S";
ErrorQueue equeue = new ErrorQueue();
Tool antlr = new Tool();
Tool antlr = g.tool;
antlr.outputDirectory = tmpdir;
antlr.libDirectory = tmpdir;
antlr.addListener(equeue);
antlr.process(g,true);