From 37631d1197d1c3e43be1022db85236627066dd79 Mon Sep 17 00:00:00 2001 From: Peter Boyer Date: Sat, 5 Nov 2016 16:27:12 -0400 Subject: [PATCH] Regen runtime-testsuite --- .../org/antlr/v4/test/runtime/go/Go.test.stg | 7 + .../v4/test/runtime/csharp/TestVisitors.java | 2 +- .../v4/test/runtime/go/TestVisitors.java | 268 ++++++++++++++++++ .../v4/test/runtime/java/TestVisitors.java | 3 +- .../runtime/javascript/node/TestVisitors.java | 4 +- .../v4/test/runtime/python2/TestVisitors.java | 6 +- .../v4/test/runtime/python3/TestVisitors.java | 6 +- 7 files changed, 283 insertions(+), 13 deletions(-) create mode 100644 runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestVisitors.java diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/go/Go.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/go/Go.test.stg index 22ce88ba5..b60b61af2 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/go/Go.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/go/Go.test.stg @@ -460,6 +460,13 @@ func pred(v bool) bool { Invoke_pred(v) ::= <)>> IgnoredTests ::= [ + "Visitors.Basic": true, + "Visitors.LR": true, + "Visitors.LRWithLabels": true, + "Visitors.RuleGetters_1": true, + "Visitors.RuleGetters_2": true, + "Visitors.TokenGetters_1": true, + "Visitors.TokenGetters_2": true, default: false ] diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestVisitors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestVisitors.java index 7431d748a..01400dafb 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestVisitors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/TestVisitors.java @@ -1,8 +1,8 @@ /* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ package org.antlr.v4.test.runtime.csharp; -import org.junit.Ignore; import org.junit.Test; +import org.junit.Ignore; @SuppressWarnings("unused") public class TestVisitors extends BaseTest { diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestVisitors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestVisitors.java new file mode 100644 index 000000000..e00cef865 --- /dev/null +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/go/TestVisitors.java @@ -0,0 +1,268 @@ +/* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ +package org.antlr.v4.test.runtime.go; + +import org.junit.Ignore; +import org.junit.Test; + +import static org.junit.Assert.*; + +public class TestVisitors extends BaseTest { + + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + @Ignore("true") + public void testBasic() throws Exception { + mkdir(parserpkgdir); + StringBuilder grammarBuilder = new StringBuilder(218); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("fmt.Println($ctx.r.ToStringTree(nil, p))\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : INT INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1 2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", "s", input, false); + assertEquals( + "(a 1 2)\n" + + "[ '1', '2' ]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + @Ignore("true") + public void testLR() throws Exception { + mkdir(parserpkgdir); + StringBuilder grammarBuilder = new StringBuilder(233); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("fmt.Println($ctx.r.ToStringTree(nil, p))\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=e ;\n"); + grammarBuilder.append("e : e op='*' e\n"); + grammarBuilder.append(" | e op='+' e\n"); + grammarBuilder.append(" | INT\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1+2*3"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", "s", input, false); + assertEquals( + "(e (e 1) + (e (e 2) * (e 3)))\n" + + "1,,2,,32 3 21 2 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + @Ignore("true") + public void testLRWithLabels() throws Exception { + mkdir(parserpkgdir); + StringBuilder grammarBuilder = new StringBuilder(273); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("fmt.Println($ctx.r.ToStringTree(nil, p))\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=e ;\n"); + grammarBuilder.append("e : e '(' eList ')' # Call\n"); + grammarBuilder.append(" | INT # Int\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("eList : e (',' e)* ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1(2,3)"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", "s", input, false); + assertEquals( + "(e (e 1) ( (eList (e 2) , (e 3)) ))\n" + + "1,,2,,3,1 [13 6]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + @Ignore("true") + public void testRuleGetters_1() throws Exception { + mkdir(parserpkgdir); + StringBuilder grammarBuilder = new StringBuilder(260); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("fmt.Println($ctx.r.ToStringTree(nil, p))\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : b b // forces list\n"); + grammarBuilder.append(" | b // a list still\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("b : ID | INT;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1 2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", "s", input, false); + assertEquals( + "(a (b 1) (b 2))\n" + + ",1 2 1\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + @Ignore("true") + public void testRuleGetters_2() throws Exception { + mkdir(parserpkgdir); + StringBuilder grammarBuilder = new StringBuilder(260); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("fmt.Println($ctx.r.ToStringTree(nil, p))\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : b b // forces list\n"); + grammarBuilder.append(" | b // a list still\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("b : ID | INT;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", "s", input, false); + assertEquals( + "(a (b abc))\n" + + "abc\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + @Ignore("true") + public void testTokenGetters_1() throws Exception { + mkdir(parserpkgdir); + StringBuilder grammarBuilder = new StringBuilder(218); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("fmt.Println($ctx.r.ToStringTree(nil, p))\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : INT INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="1 2"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", "s", input, false); + assertEquals( + "(a 1 2)\n" + + ",1 2 [1, 2]\n", found); + assertNull(this.stderrDuringParse); + + } + /* This file and method are generated by TestGenerator, any edits will be overwritten by the next generation. */ + @Test + @Ignore("true") + public void testTokenGetters_2() throws Exception { + mkdir(parserpkgdir); + StringBuilder grammarBuilder = new StringBuilder(218); + grammarBuilder.append("grammar T;\n"); + grammarBuilder.append("@parser::header {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("@parser::members {\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append("\n"); + grammarBuilder.append("s\n"); + grammarBuilder.append("@after {\n"); + grammarBuilder.append("fmt.Println($ctx.r.ToStringTree(nil, p))\n"); + grammarBuilder.append("}\n"); + grammarBuilder.append(" : r=a ;\n"); + grammarBuilder.append("a : INT INT\n"); + grammarBuilder.append(" | ID\n"); + grammarBuilder.append(" ;\n"); + grammarBuilder.append("MULT: '*' ;\n"); + grammarBuilder.append("ADD : '+' ;\n"); + grammarBuilder.append("INT : [0-9]+ ;\n"); + grammarBuilder.append("ID : [a-z]+ ;\n"); + grammarBuilder.append("WS : [ \\t\\n]+ -> skip ;"); + String grammar = grammarBuilder.toString(); + String input ="abc"; + String found = execParser("T.g4", grammar, "TParser", "TLexer", + "TListener", "TVisitor", "s", input, false); + assertEquals( + "(a abc)\n" + + "[@0,0:2='abc',<4>,1:0]\n", found); + assertNull(this.stderrDuringParse); + + } + +} diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestVisitors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestVisitors.java index 0db79a147..af040534c 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestVisitors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/java/TestVisitors.java @@ -4,8 +4,7 @@ package org.antlr.v4.test.runtime.java; import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.*; public class TestVisitors extends BaseTest { diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/node/TestVisitors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/node/TestVisitors.java index 44f7411e4..03d70d854 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/node/TestVisitors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/javascript/node/TestVisitors.java @@ -1,10 +1,10 @@ /* This file is generated by TestGenerator, any edits will be overwritten by the next generation. */ package org.antlr.v4.test.runtime.javascript.node; +import org.junit.Ignore; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.*; @SuppressWarnings("unused") public class TestVisitors extends BaseTest { diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestVisitors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestVisitors.java index 79c001ec5..8c86fb55f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestVisitors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python2/TestVisitors.java @@ -3,9 +3,7 @@ package org.antlr.v4.test.runtime.python2; import org.junit.Ignore; import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.*; @SuppressWarnings("unused") public class TestVisitors extends BasePython2Test { @@ -295,4 +293,4 @@ public class TestVisitors extends BasePython2Test { } -} +} \ No newline at end of file diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestVisitors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestVisitors.java index d8cb927c9..873ef665f 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestVisitors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/python3/TestVisitors.java @@ -3,9 +3,7 @@ package org.antlr.v4.test.runtime.python3; import org.junit.Ignore; import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; +import static org.junit.Assert.*; @SuppressWarnings("unused") public class TestVisitors extends BasePython3Test { @@ -295,4 +293,4 @@ public class TestVisitors extends BasePython3Test { } -} +} \ No newline at end of file