Add AssignTokenNamesToStringLiteralsInGeneratedParserRuleContexts and AssignTokenNamesToStringLiteralArraysInGeneratedParserRuleContexts unit-tests
This commit is contained in:
parent
70e3e5de70
commit
2f7c5bfe4a
|
@ -31,6 +31,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
public class TestCodeGeneration extends BaseJavaToolTest {
|
||||
@Before
|
||||
|
@ -52,6 +53,24 @@ public class TestCodeGeneration extends BaseJavaToolTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test public void AssignTokenNamesToStringLiteralsInGeneratedParserRuleContexts() throws Exception {
|
||||
String g =
|
||||
"grammar T;\n" +
|
||||
"root: 't1';\n" +
|
||||
"Token: 't1';";
|
||||
List<String> evals = getEvalInfoForString(g, "() { return getToken(");
|
||||
assertNotEquals(0, evals.size());
|
||||
}
|
||||
|
||||
@Test public void AssignTokenNamesToStringLiteralArraysInGeneratedParserRuleContexts() throws Exception {
|
||||
String g =
|
||||
"grammar T;\n" +
|
||||
"root: 't1' 't1';\n" +
|
||||
"Token: 't1';";
|
||||
List<String> evals = getEvalInfoForString(g, "() { return getTokens(");
|
||||
assertNotEquals(0, evals.size());
|
||||
}
|
||||
|
||||
/** Add tags around each attribute/template/value write */
|
||||
public static class DebugInterpreter extends Interpreter {
|
||||
List<String> evals = new ArrayList<String>();
|
||||
|
|
Loading…
Reference in New Issue