fix unit tests for recent bug fix so that they work with JavaScript.

This commit is contained in:
Terence Parr 2015-01-22 16:59:09 -08:00
parent 2be74daaae
commit 790994f531
3 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,3 @@
grammar <grammarName>;
myset: ('b'|'c') ;
a: 'a' myset 'd' {<writeln("$myset.stop")>} ;
a: 'a' myset 'd' {<writeln(Append("\"\"","$myset.stop"))>} ; <! bit complicated because of the JavaScript target !>

View File

@ -1,3 +1,3 @@
grammar <grammarName>;
myset: ('b'|'c') ;
a: 'a' myset 'd' {<writeln("$myset.stop")>} ;
a: 'a' myset 'd' {<writeln(Append("\"\"","$myset.stop"))>} ; <! bit complicated because of the JavaScript target !>

View File

@ -1,7 +1,9 @@
package org.antlr.v4.test.rt.java;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class TestParserErrors extends BaseTest {
@ -40,7 +42,7 @@ public class TestParserErrors extends BaseTest {
public void testSingleTokenDeletionConsumption() throws Exception {
String grammar = "grammar T;\n" +
"myset: ('b'|'c') ;\n" +
"a: 'a' myset 'd' {System.out.println($myset.stop);} ;";
"a: 'a' myset 'd' {System.out.println(\"\" + $myset.stop);} ; ";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "a", "aabd", false);
assertEquals("[@2,2:2='b',<1>,1:2]\n", found);
assertEquals("line 1:1 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse);
@ -81,7 +83,7 @@ public class TestParserErrors extends BaseTest {
public void testSingleSetInsertionConsumption() throws Exception {
String grammar = "grammar T;\n" +
"myset: ('b'|'c') ;\n" +
"a: 'a' myset 'd' {System.out.println($myset.stop);} ;";
"a: 'a' myset 'd' {System.out.println(\"\" + $myset.stop);} ; ";
String found = execParser("T.g4", grammar, "TParser", "TLexer", "a", "ad", false);
assertEquals("[@0,0:0='a',<3>,1:0]\n", found);
assertEquals("line 1:1 missing {'b', 'c'} at 'd'\n", this.stderrDuringParse);
@ -331,4 +333,4 @@ public class TestParserErrors extends BaseTest {
}
}
}