Fix unit test placing output files like "null.java" in the project directory
This commit is contained in:
parent
f8285bcca0
commit
146a9b0509
|
@ -303,6 +303,7 @@ public class CodeGenerator {
|
||||||
* TListener.java, if we're using the Java target.
|
* TListener.java, if we're using the Java target.
|
||||||
*/
|
*/
|
||||||
public String getListenerFileName() {
|
public String getListenerFileName() {
|
||||||
|
assert g.name != null;
|
||||||
ST extST = templates.getInstanceOf("codeFileExtension");
|
ST extST = templates.getInstanceOf("codeFileExtension");
|
||||||
String listenerName = g.name + "Listener";
|
String listenerName = g.name + "Listener";
|
||||||
return listenerName+extST.render();
|
return listenerName+extST.render();
|
||||||
|
@ -312,6 +313,7 @@ public class CodeGenerator {
|
||||||
* such as BlankTListener.java, if we're using the Java target.
|
* such as BlankTListener.java, if we're using the Java target.
|
||||||
*/
|
*/
|
||||||
public String getBlankListenerFileName() {
|
public String getBlankListenerFileName() {
|
||||||
|
assert g.name != null;
|
||||||
ST extST = templates.getInstanceOf("codeFileExtension");
|
ST extST = templates.getInstanceOf("codeFileExtension");
|
||||||
String listenerName = "Blank" + g.name + "Listener";
|
String listenerName = "Blank" + g.name + "Listener";
|
||||||
return listenerName+extST.render();
|
return listenerName+extST.render();
|
||||||
|
|
|
@ -42,10 +42,14 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
String grammar =
|
String grammar =
|
||||||
"parser grammar S;\n" +
|
"parser grammar S;\n" +
|
||||||
"a : B . C ;\n"; // not qualified ID
|
"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();
|
ErrorQueue equeue = new ErrorQueue();
|
||||||
Tool antlr = new Tool();
|
Tool antlr = g.tool;
|
||||||
|
antlr.outputDirectory = tmpdir;
|
||||||
|
antlr.libDirectory = tmpdir;
|
||||||
antlr.addListener(equeue);
|
antlr.addListener(equeue);
|
||||||
antlr.process(g,true);
|
antlr.process(g,true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue