Fix testOptional and testNoViableAltAvoidance

This commit is contained in:
Sam Harwell 2012-10-14 22:41:18 -05:00
parent aa2223cd6a
commit d738949ccd
2 changed files with 5 additions and 5 deletions

View File

@ -292,7 +292,7 @@ public class TestParseErrors extends BaseTest {
"WS : [ \\t\\r\\n]+ -> skip;\n";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "s", "a.", false);
String expecting =
"exec stderrVacuum: line 1:1 mismatched input '.' expecting '!'";
"line 1:1 mismatched input '.' expecting '!'\n";
String result = stderrDuringParse;
assertEquals(expecting, result);
}

View File

@ -164,8 +164,8 @@ public class TestParserExec extends BaseTest {
/**
* Related to https://github.com/antlr/antlr4/issues/41. EOF is
* not viable after "if x" since EOF not viable after stat.
* This test is meant to detect regressions of bug antlr/antlr4#41.
* https://github.com/antlr/antlr4/issues/41
*/
@Test
public void testOptional() throws Exception {
@ -186,11 +186,11 @@ public class TestParserExec extends BaseTest {
found = execParser("T.g4", grammar, "TParser", "TLexer", "stat", "if x", false);
assertEquals("", found);
assertEquals("line 1:4 no viable alternative at input '<EOF>'\n", this.stderrDuringParse);
assertNull(this.stderrDuringParse);
found = execParser("T.g4", grammar, "TParser", "TLexer", "stat", "if if x else x", false);
assertEquals("", found);
assertEquals("line 1:14 no viable alternative at input '<EOF>'\n", this.stderrDuringParse);
assertNull(this.stderrDuringParse);
}
/**