This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit bfc91459aeb48c7b14574bbc183b9dc3edc5d337
Author: Daniel Sun <sun...@apache.org>
AuthorDate: Sat Jun 7 14:33:05 2025 +0900

    Add `switch` test cases for GINQ
    
    (cherry picked from commit 3707260f51b65568111e70929fc82792a6b37395)
---
 .../src/spec/test/org/apache/groovy/ginq/GinqTest.groovy  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/subprojects/groovy-ginq/src/spec/test/org/apache/groovy/ginq/GinqTest.groovy 
b/subprojects/groovy-ginq/src/spec/test/org/apache/groovy/ginq/GinqTest.groovy
index 7ca916932f..dad032f2c6 100644
--- 
a/subprojects/groovy-ginq/src/spec/test/org/apache/groovy/ginq/GinqTest.groovy
+++ 
b/subprojects/groovy-ginq/src/spec/test/org/apache/groovy/ginq/GinqTest.groovy
@@ -6346,6 +6346,21 @@ class GinqTest {
         '''
     }
 
+    @Test
+    void "testGinq - switch - 5"() {
+        assertGinqScript '''
+            assert [[1, 3], [3, 1]] == GQ {
+                from n in [1, 1, 3, 4]
+                groupby switch (n) {
+                    case 4 -> 1
+                    default -> n
+                } as g
+                orderby g
+                select g, count()
+            }.toList()
+        '''
+    }
+
     @Test
     void "testGinqMethod - GQ - 0"() {
         assertScript '''

Reply via email to