forked from jasder/antlr
Add a test case for merging clashing channel names during import.
This commit is contained in:
parent
490cd7068c
commit
d2685bf37f
|
@ -142,6 +142,28 @@ public class TestCompositeGrammars extends BaseJavaToolTest {
|
|||
assertEquals(0, equeue.errors.size());
|
||||
}
|
||||
|
||||
@Test public void testImportClashingChannelsIntoLexerGrammar() throws Exception {
|
||||
BaseRuntimeTest.mkdir(tmpdir);
|
||||
|
||||
String master =
|
||||
"lexer grammar M;\n" +
|
||||
"import S;\n" +
|
||||
"channels {CH_A, CH_B, CH_C}\n" +
|
||||
"A : 'a' -> channel(CH_A);\n" +
|
||||
"B : 'b' -> channel(CH_B);\n" +
|
||||
"C : 'C' -> channel(CH_C);\n";
|
||||
writeFile(tmpdir, "M.g4", master);
|
||||
|
||||
String slave =
|
||||
"lexer grammar S;\n" +
|
||||
"channels {CH_C}\n" +
|
||||
"C : 'c' -> channel(CH_C);\n";
|
||||
writeFile(tmpdir, "S.g4", slave);
|
||||
|
||||
ErrorQueue equeue = BaseRuntimeTest.antlrOnString(tmpdir, "Java", "M.g4", false, "-lib", tmpdir);
|
||||
assertEquals(0, equeue.errors.size());
|
||||
}
|
||||
|
||||
@Test public void testMergeModesIntoLexerGrammar() throws Exception {
|
||||
BaseRuntimeTest.mkdir(tmpdir);
|
||||
|
||||
|
|
Loading…
Reference in New Issue