fix unit tests
This commit is contained in:
parent
91bad33f57
commit
1909fb3f85
|
@ -105,7 +105,7 @@ public class TestATNSerialization extends BaseTest {
|
||||||
@Test public void testNot() throws Exception {
|
@Test public void testNot() throws Exception {
|
||||||
Grammar g = new Grammar(
|
Grammar g = new Grammar(
|
||||||
"parser grammar T;\n"+
|
"parser grammar T;\n"+
|
||||||
"tokens {A; B; C;}\n" +
|
"tokens {A, B, C}\n" +
|
||||||
"a : ~A ;");
|
"a : ~A ;");
|
||||||
String expecting =
|
String expecting =
|
||||||
"max type 3\n" +
|
"max type 3\n" +
|
||||||
|
@ -129,7 +129,7 @@ public class TestATNSerialization extends BaseTest {
|
||||||
@Test public void testWildcard() throws Exception {
|
@Test public void testWildcard() throws Exception {
|
||||||
Grammar g = new Grammar(
|
Grammar g = new Grammar(
|
||||||
"parser grammar T;\n"+
|
"parser grammar T;\n"+
|
||||||
"tokens {A; B; C;}\n" +
|
"tokens {A, B, C}\n" +
|
||||||
"a : . ;");
|
"a : . ;");
|
||||||
String expecting =
|
String expecting =
|
||||||
"max type 3\n" +
|
"max type 3\n" +
|
||||||
|
|
|
@ -9,7 +9,7 @@ public class TestAttributeChecks extends BaseTest {
|
||||||
String attributeTemplate =
|
String attributeTemplate =
|
||||||
"parser grammar A;\n"+
|
"parser grammar A;\n"+
|
||||||
"@members {<members>}\n" +
|
"@members {<members>}\n" +
|
||||||
"tokens{ID;}\n" +
|
"tokens{ID}\n" +
|
||||||
"a[int x] returns [int y]\n" +
|
"a[int x] returns [int y]\n" +
|
||||||
"@init {<init>}\n" +
|
"@init {<init>}\n" +
|
||||||
" : id=ID ids+=ID lab=b[34] {\n" +
|
" : id=ID ids+=ID lab=b[34] {\n" +
|
||||||
|
|
|
@ -173,13 +173,13 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
@Test public void testDelegatesSeeSameTokenType() throws Exception {
|
@Test public void testDelegatesSeeSameTokenType() throws Exception {
|
||||||
String slave =
|
String slave =
|
||||||
"parser grammar S;\n" + // A, B, C token type order
|
"parser grammar S;\n" + // A, B, C token type order
|
||||||
"tokens { A; B; C; }\n" +
|
"tokens { A, B, C }\n" +
|
||||||
"x : A {System.out.println(\"S.x\");} ;\n";
|
"x : A {System.out.println(\"S.x\");} ;\n";
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "S.g4", slave);
|
writeFile(tmpdir, "S.g4", slave);
|
||||||
String slave2 =
|
String slave2 =
|
||||||
"parser grammar T;\n" +
|
"parser grammar T;\n" +
|
||||||
"tokens { C; B; A; }\n" + // reverse order
|
"tokens { C, B, A }\n" + // reverse order
|
||||||
"y : A {System.out.println(\"T.y\");} ;\n";
|
"y : A {System.out.println(\"T.y\");} ;\n";
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "T.g4", slave2);
|
writeFile(tmpdir, "T.g4", slave2);
|
||||||
|
@ -212,13 +212,13 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
ErrorQueue equeue = new ErrorQueue();
|
ErrorQueue equeue = new ErrorQueue();
|
||||||
String slave =
|
String slave =
|
||||||
"parser grammar S;\n" + // A, B, C token type order
|
"parser grammar S;\n" + // A, B, C token type order
|
||||||
"tokens { A; B; C; }\n" +
|
"tokens { A, B, C }\n" +
|
||||||
"x : A {System.out.println(\"S.x\");} ;\n";
|
"x : A {System.out.println(\"S.x\");} ;\n";
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "S.g4", slave);
|
writeFile(tmpdir, "S.g4", slave);
|
||||||
String slave2 =
|
String slave2 =
|
||||||
"parser grammar T;\n" +
|
"parser grammar T;\n" +
|
||||||
"tokens { C; B; A; }\n" + // reverse order
|
"tokens { C, B, A }\n" + // reverse order
|
||||||
"y : A {System.out.println(\"T.y\");} ;\n";
|
"y : A {System.out.println(\"T.y\");} ;\n";
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "T.g4", slave2);
|
writeFile(tmpdir, "T.g4", slave2);
|
||||||
|
@ -254,7 +254,7 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
ErrorQueue equeue = new ErrorQueue();
|
ErrorQueue equeue = new ErrorQueue();
|
||||||
String slave =
|
String slave =
|
||||||
"grammar S;\n" + // A, B, C token type order
|
"grammar S;\n" + // A, B, C token type order
|
||||||
"tokens { A; B; C; }\n" +
|
"tokens { A, B, C }\n" +
|
||||||
"x : 'x' INT {System.out.println(\"S.x\");} ;\n" +
|
"x : 'x' INT {System.out.println(\"S.x\");} ;\n" +
|
||||||
"INT : '0'..'9'+ ;\n" +
|
"INT : '0'..'9'+ ;\n" +
|
||||||
"WS : (' '|'\\n') {skip();} ;\n";
|
"WS : (' '|'\\n') {skip();} ;\n";
|
||||||
|
@ -280,7 +280,7 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
String slave =
|
String slave =
|
||||||
"parser grammar S;\n" +
|
"parser grammar S;\n" +
|
||||||
"options {tokenVocab=whatever;}\n" +
|
"options {tokenVocab=whatever;}\n" +
|
||||||
"tokens { A='a'; }\n" +
|
"tokens { A }\n" +
|
||||||
"x : A {System.out.println(\"S.x\");} ;\n";
|
"x : A {System.out.println(\"S.x\");} ;\n";
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "S.g4", slave);
|
writeFile(tmpdir, "S.g4", slave);
|
||||||
|
@ -374,7 +374,7 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
|
|
||||||
String slave2 =
|
String slave2 =
|
||||||
"parser grammar T;\n" +
|
"parser grammar T;\n" +
|
||||||
"tokens { A='x'; }\n" +
|
"tokens { A }\n" +
|
||||||
"b : 'b' {System.out.println(\"T.b\");} ;\n";
|
"b : 'b' {System.out.println(\"T.b\");} ;\n";
|
||||||
writeFile(tmpdir, "T.g4", slave2);
|
writeFile(tmpdir, "T.g4", slave2);
|
||||||
|
|
||||||
|
@ -500,34 +500,34 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
ErrorQueue equeue = new ErrorQueue();
|
ErrorQueue equeue = new ErrorQueue();
|
||||||
String slave =
|
String slave =
|
||||||
"parser grammar T;\n" +
|
"parser grammar T;\n" +
|
||||||
"tokens{T;}\n" +
|
"tokens{T}\n" +
|
||||||
"x : T ;\n" ;
|
"x : T ;\n" ;
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "T.g4", slave);
|
writeFile(tmpdir, "T.g4", slave);
|
||||||
slave =
|
slave =
|
||||||
"parser grammar S;\n" +
|
"parser grammar S;\n" +
|
||||||
"import T;\n" +
|
"import T;\n" +
|
||||||
"tokens{S;}\n" +
|
"tokens{S}\n" +
|
||||||
"y : S ;\n" ;
|
"y : S ;\n" ;
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "S.g4", slave);
|
writeFile(tmpdir, "S.g4", slave);
|
||||||
|
|
||||||
slave =
|
slave =
|
||||||
"parser grammar C;\n" +
|
"parser grammar C;\n" +
|
||||||
"tokens{C;}\n" +
|
"tokens{C}\n" +
|
||||||
"i : C ;\n" ;
|
"i : C ;\n" ;
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "C.g4", slave);
|
writeFile(tmpdir, "C.g4", slave);
|
||||||
slave =
|
slave =
|
||||||
"parser grammar B;\n" +
|
"parser grammar B;\n" +
|
||||||
"tokens{B;}\n" +
|
"tokens{B}\n" +
|
||||||
"j : B ;\n" ;
|
"j : B ;\n" ;
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "B.g4", slave);
|
writeFile(tmpdir, "B.g4", slave);
|
||||||
slave =
|
slave =
|
||||||
"parser grammar A;\n" +
|
"parser grammar A;\n" +
|
||||||
"import B,C;\n" +
|
"import B,C;\n" +
|
||||||
"tokens{A;}\n" +
|
"tokens{A}\n" +
|
||||||
"k : A ;\n" ;
|
"k : A ;\n" ;
|
||||||
mkdir(tmpdir);
|
mkdir(tmpdir);
|
||||||
writeFile(tmpdir, "A.g4", slave);
|
writeFile(tmpdir, "A.g4", slave);
|
||||||
|
@ -535,7 +535,7 @@ public class TestCompositeGrammars extends BaseTest {
|
||||||
String master =
|
String master =
|
||||||
"grammar M;\n" +
|
"grammar M;\n" +
|
||||||
"import S,A;\n" +
|
"import S,A;\n" +
|
||||||
"tokens{M;}\n" +
|
"tokens{M}\n" +
|
||||||
"a : M ;\n" ;
|
"a : M ;\n" ;
|
||||||
writeFile(tmpdir, "M.g4", master);
|
writeFile(tmpdir, "M.g4", master);
|
||||||
Grammar g = new Grammar(tmpdir+"/M.g4", master, equeue);
|
Grammar g = new Grammar(tmpdir+"/M.g4", master, equeue);
|
||||||
|
|
Loading…
Reference in New Issue