This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 3707260f51 Add `switch` test cases for GINQ
3707260f51 is described below
commit 3707260f51b65568111e70929fc82792a6b37395
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Jun 7 14:33:05 2025 +0900
Add `switch` test cases for GINQ
---
.../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 '''