groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Add more test cases for the standard "for" loop statement
Date Sat, 28 Jan 2017 15:01:04 GMT
Repository: groovy
Updated Branches:
  refs/heads/parrot 4e3b987aa -> a033231e2


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/parrot
Commit: a033231e223bc7fec108773bec200c5cfb33195b
Parents: 4e3b987
Author: sunlan <sunlan@apache.org>
Authored: Sat Jan 28 23:00:51 2017 +0800
Committer: sunlan <sunlan@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();


Mime
View raw message