You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/04/11 01:38:04 UTC
[28/50] groovy git commit: Add more test cases for the standard "for"
loop statement
Add more test cases for the standard "for" loop statement
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/a033231e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/a033231e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/a033231e
Branch: refs/heads/master
Commit: a033231e223bc7fec108773bec200c5cfb33195b
Parents: 4e3b987
Author: sunlan <su...@apache.org>
Authored: Sat Jan 28 23:00:51 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Sat Jan 28 23:00:51 2017 +0800
----------------------------------------------------------------------
.../src/test/resources/core/For_05x.groovy | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/a033231e/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy b/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
index fe55805..959d2c0 100644
--- a/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
+++ b/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
@@ -6,8 +6,16 @@ def testCS() {
for (int i = 0, n = 5; i < n; i++) {
result += i
}
-
assert 10 == result
+
+ result = 0;
+ int i;
+ int j;
+ for (i = 1, j = 5; i < j; i++, j--) {
+ result += i;
+ result += j;
+ }
+ assert 12 == result
}
testCS();
@@ -16,7 +24,15 @@ def test() {
for (int i = 0, n = 5; i < n; i++) {
result += i
}
-
assert 10 == result
+
+ result = 0;
+ int i;
+ int j;
+ for (i = 1, j = 5; i < j; i++, j--) {
+ result += i;
+ result += j;
+ }
+ assert 12 == result
}
test();