forked from jasder/antlr
fix unit tests for recent bug fix so that they work with JavaScript.
This commit is contained in:
parent
c84f024676
commit
65e4dc47e1
|
@ -1,3 +1,3 @@
|
||||||
grammar <grammarName>;
|
grammar <grammarName>;
|
||||||
myset: ('b'|'c') ;
|
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 !>
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
grammar <grammarName>;
|
grammar <grammarName>;
|
||||||
myset: ('b'|'c') ;
|
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 !>
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package org.antlr.v4.test.rt.java;
|
package org.antlr.v4.test.rt.java;
|
||||||
|
|
||||||
import org.junit.Test;
|
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 {
|
public class TestParserErrors extends BaseTest {
|
||||||
|
|
||||||
|
@ -40,7 +42,7 @@ public class TestParserErrors extends BaseTest {
|
||||||
public void testSingleTokenDeletionConsumption() throws Exception {
|
public void testSingleTokenDeletionConsumption() throws Exception {
|
||||||
String grammar = "grammar T;\n" +
|
String grammar = "grammar T;\n" +
|
||||||
"myset: ('b'|'c') ;\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);
|
String found = execParser("T.g4", grammar, "TParser", "TLexer", "a", "aabd", false);
|
||||||
assertEquals("[@2,2:2='b',<1>,1:2]\n", found);
|
assertEquals("[@2,2:2='b',<1>,1:2]\n", found);
|
||||||
assertEquals("line 1:1 extraneous input 'a' expecting {'b', 'c'}\n", this.stderrDuringParse);
|
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 {
|
public void testSingleSetInsertionConsumption() throws Exception {
|
||||||
String grammar = "grammar T;\n" +
|
String grammar = "grammar T;\n" +
|
||||||
"myset: ('b'|'c') ;\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);
|
String found = execParser("T.g4", grammar, "TParser", "TLexer", "a", "ad", false);
|
||||||
assertEquals("[@0,0:0='a',<3>,1:0]\n", found);
|
assertEquals("[@0,0:0='a',<3>,1:0]\n", found);
|
||||||
assertEquals("line 1:1 missing {'b', 'c'} at 'd'\n", this.stderrDuringParse);
|
assertEquals("line 1:1 missing {'b', 'c'} at 'd'\n", this.stderrDuringParse);
|
||||||
|
|
Loading…
Reference in New Issue