Merge pull request #716 from sharwell/fix-670

Add regression test for #670
This commit is contained in:
Terence Parr 2014-09-26 14:31:10 -07:00
commit 0d18457c6d
1 changed files with 20 additions and 0 deletions

View File

@ -797,4 +797,24 @@ public class TestCompositeGrammars extends BaseTest {
assertEquals("", found); assertEquals("", found);
assertNull(stderrDuringParse); assertNull(stderrDuringParse);
} }
/**
* This is a regression test for antlr/antlr4#670 "exception when importing
* grammar".
* https://github.com/antlr/antlr4/issues/670
*/
@Test
public void testImportLargeGrammar() throws Exception {
String slave = load("Java.g4", "UTF-8");
String master =
"grammar NewJava;\n" +
"import Java;\n";
System.out.println("dir "+tmpdir);
mkdir(tmpdir);
writeFile(tmpdir, "Java.g4", slave);
String found = execParser("NewJava.g4", master, "NewJavaParser", "NewJavaLexer", "compilationUnit", "package Foo;", debug);
assertEquals("", found);
assertNull(stderrDuringParse);
}
} }