Compile listeners and visitors with the unit tests by default to help catch compile errors with them

This commit is contained in:
Sam Harwell 2012-02-23 09:58:20 -06:00
parent db4ce6dd8e
commit 4ae58868d7
1 changed files with 13 additions and 2 deletions

View File

@ -431,7 +431,9 @@ public abstract class BaseTest {
boolean success = rawGenerateAndBuildRecognizer(grammarFileName,
grammarStr,
parserName,
lexerName);
lexerName,
"-parse-listener",
"-visitor");
assertTrue(success);
writeFile(tmpdir, "input", input);
return rawExecRecognizer(parserName,
@ -456,7 +458,16 @@ public abstract class BaseTest {
}
if ( parserName!=null ) {
files.add(parserName+".java");
files.add(grammarFileName.substring(0, grammarFileName.lastIndexOf('.'))+"BaseListener.java");
Set<String> optionsSet = new HashSet<String>(Arrays.asList(extraOptions));
if (!optionsSet.contains("-no-listener")) {
files.add(grammarFileName.substring(0, grammarFileName.lastIndexOf('.'))+"BaseListener.java");
}
if (optionsSet.contains("-visitor")) {
files.add(grammarFileName.substring(0, grammarFileName.lastIndexOf('.'))+"BaseVisitor.java");
}
if (optionsSet.contains("-parse-listener")) {
files.add(grammarFileName.substring(0, grammarFileName.lastIndexOf('.'))+"BaseParseListener.java");
}
}
ok = compile(files.toArray(new String[files.size()]));
if ( !ok ) { allIsWell = false; }