Add test case for GROOVY-3898: Allow the specification of types when initializing multiple iteration variables in a "for" construct
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/0e608ee5 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/0e608ee5 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/0e608ee5 Branch: refs/heads/master Commit: 0e608ee5310d96031ea96da1a11b0eb7c7a92a4e Parents: 348465a Author: sunlan <[email protected]> Authored: Thu Jan 19 20:47:49 2017 +0800 Committer: sunlan <[email protected]> Committed: Thu Jan 19 20:47:49 2017 +0800 ---------------------------------------------------------------------- .../org/apache/groovy/parser/antlr4/GroovyParserTest.groovy | 1 + .../src/test/resources/bugs/GROOVY-3898.groovy | 8 ++++++++ 2 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/0e608ee5/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy ---------------------------------------------------------------------- diff --git a/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy index 3f3a63c..e70cd90 100644 --- a/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy +++ b/subprojects/groovy-parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy @@ -328,6 +328,7 @@ class GroovyParserTest extends GroovyTestCase { void "test groovy core - BUG"() { doRunAndTest('bugs/BUG-GROOVY-4757.groovy'); + doRunAndTest('bugs/GROOVY-3898.groovy'); } } http://git-wip-us.apache.org/repos/asf/groovy/blob/0e608ee5/subprojects/groovy-parser-antlr4/src/test/resources/bugs/GROOVY-3898.groovy ---------------------------------------------------------------------- diff --git a/subprojects/groovy-parser-antlr4/src/test/resources/bugs/GROOVY-3898.groovy b/subprojects/groovy-parser-antlr4/src/test/resources/bugs/GROOVY-3898.groovy new file mode 100644 index 0000000..9f07edb --- /dev/null +++ b/subprojects/groovy-parser-antlr4/src/test/resources/bugs/GROOVY-3898.groovy @@ -0,0 +1,8 @@ +package bugs + +int result = 1 +for((i, j) = [0,0]; i < 3; {i++; j++}()){ + result = result * i + j +} +assert 4 == result +
