You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2021/07/19 11:14:06 UTC

[groovy] branch master updated: Add a test for `distinct`

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 e2611fc  Add a test for `distinct`
e2611fc is described below

commit e2611fc3347fa995c0cf2302597aecaeb8b113a5
Author: Daniel Sun <su...@apache.org>
AuthorDate: Mon Jul 19 19:13:50 2021 +0800

    Add a test for `distinct`
---
 .../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 8220c90..8d963a9 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
@@ -275,6 +275,21 @@ class GinqTest {
     }
 
     @Test
+    void "testGinq - from select distinct - 4"() {
+        assertGinqScript '''
+            def result = GQ {
+                from v in (
+                    from n in [1, 2, 2, 3, 3, 3]
+                    select distinct(n)
+                )
+                join m in [1, 1, 2, 2, 3, 3] on m == v
+                select v, m
+            }
+            assert [[1, 1], [1, 1], [2, 2], [2, 2], [3, 3], [3, 3]] == result.toList()
+        '''
+    }
+
+    @Test
     void "testGinq - from where select - 1"() {
         assertGinqScript '''
             def numbers = [0, 1, 2, 3, 4, 5]