You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2017/08/26 19:33:34 UTC

groovy git commit: GROOVY-8205: Regression test for STC Enum values DGM methods (closes #592)

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_6_X 5349e7e71 -> c030fb713


GROOVY-8205: Regression test for STC Enum values DGM methods (closes #592)

Issue fixed by commit 8c218dec34 (GROOVY-7283)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/c030fb71
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/c030fb71
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/c030fb71

Branch: refs/heads/GROOVY_2_6_X
Commit: c030fb7136e346115b4846c5e204148d677297ce
Parents: 5349e7e
Author: John Wagenleitner <jw...@apache.org>
Authored: Sat Aug 26 11:55:25 2017 -0700
Committer: John Wagenleitner <jw...@apache.org>
Committed: Sat Aug 26 12:32:51 2017 -0700

----------------------------------------------------------------------
 .../stc/DefaultGroovyMethodsSTCTest.groovy      | 23 +++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/c030fb71/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy b/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
index db43b5b..81eb450 100644
--- a/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
@@ -179,5 +179,26 @@ class DefaultGroovyMethodsSTCTest extends StaticTypeCheckingTestCase {
             assert sorted3*.value == [10, 5, 20, 15]
         '''
     }
-}
 
+    // GROOVY-8205
+    void testEachOnEnumValues() {
+        assertScript '''
+            enum Functions {
+                A, B, C
+            }
+            def m() {
+                def results = []
+                Functions.values().each { results << it.name() }
+                results
+            }
+            def m2() {
+                def results = [:]
+                Functions.values().eachWithIndex { val, idx -> results[idx] = val.name() }
+                results
+            } 
+            assert m() == ['A', 'B', 'C']
+            assert m2() == [0: 'A', 1: 'B', 2: 'C']
+        '''
+    }
+
+}