Merge pull request #730 from ericvergnaud/improve-test-granularity

improve test granularity
This commit is contained in:
ericvergnaud 2014-10-05 00:39:49 +08:00
commit abf1052426
1 changed files with 23 additions and 16 deletions

View File

@ -304,8 +304,7 @@ public class TestParseErrors extends BaseTest {
* This is a regression test for #26 "an exception upon simple rule with double recursion in an alternative".
* https://github.com/antlr/antlr4/issues/26
*/
@Test
public void testDuplicatedLeftRecursiveCall() throws Exception {
void testDuplicatedLeftRecursiveCall(String input) throws Exception {
String grammar =
"grammar T;\n" +
"start : expr EOF;\n" +
@ -313,24 +312,32 @@ public class TestParseErrors extends BaseTest {
" | expr expr\n" +
" ;\n" +
"\n";
String result = execParser("T.g4", grammar, "TParser", "TLexer", "start", "x", true);
assertEquals("", result);
assertNull(this.stderrDuringParse);
result = execParser("T.g4", grammar, "TParser", "TLexer", "start", "xx", true);
assertEquals("", result);
assertNull(this.stderrDuringParse);
result = execParser("T.g4", grammar, "TParser", "TLexer", "start", "xxx", true);
assertEquals("", result);
assertNull(this.stderrDuringParse);
result = execParser("T.g4", grammar, "TParser", "TLexer", "start", "xxxx", true);
String result = execParser("T.g4", grammar, "TParser", "TLexer", "start", input, true);
assertEquals("", result);
assertNull(this.stderrDuringParse);
}
@Test
public void testDuplicatedLeftRecursiveCall1() throws Exception {
testDuplicatedLeftRecursiveCall("x");
}
@Test
public void testDuplicatedLeftRecursiveCall2() throws Exception {
testDuplicatedLeftRecursiveCall("xx");
}
@Test
public void testDuplicatedLeftRecursiveCall3() throws Exception {
testDuplicatedLeftRecursiveCall("xxx");
}
@Test
public void testDuplicatedLeftRecursiveCall4() throws Exception {
testDuplicatedLeftRecursiveCall("xxxx");
}
/**
* This is a regression test for #45 "NullPointerException in ATNConfig.hashCode".
* https://github.com/antlr/antlr4/issues/45