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/23 04:47:50 UTC

[groovy] branch master updated: Add more tests for GINQ

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 10d02a8  Add more tests for GINQ
10d02a8 is described below

commit 10d02a8d60451e1f87a4678aaa0cc99791afab23
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Jul 23 12:45:52 2021 +0800

    Add more tests for GINQ
---
 .../test/org/apache/groovy/ginq/GinqTest.groovy    | 39 ++++++++++++++++++----
 1 file changed, 33 insertions(+), 6 deletions(-)

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 756f2fc..8b11cdc 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
@@ -33,6 +33,7 @@ import org.codehaus.groovy.ast.stmt.ExpressionStatement
 import org.codehaus.groovy.control.CompilationUnit
 import org.codehaus.groovy.control.Phases
 import org.codehaus.groovy.syntax.Types
+import org.junit.AfterClass
 import org.junit.Test
 
 import static groovy.test.GroovyAssert.assertScript
@@ -2483,6 +2484,32 @@ class GinqTest {
     }
 
     @Test
+    void "testGinq - from join where select - 1"() {
+        assertGinqScript '''
+            def result = GQ(optimize:false, parallel:true) {
+                from n1 in 1..100_000
+                join n2 in 1..100_000 on n2 == n1
+                where n1 < 10 && n2 < 20
+                select n1, n2
+            }.toList()
+            assert [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]] == result
+        '''
+    }
+
+    @Test
+    void "testGinq - from join where select - 2"() {
+        assertGinqScript '''
+            def result = GQ(optimize:false, parallel:false) {
+                from n1 in 1..100_000
+                join n2 in 1..100_000 on n2 == n1
+                where n1 < 10 && n2 < 20
+                select n1, n2
+            }.toList()
+            assert [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9]] == result
+        '''
+    }
+
+    @Test
     void "testGinq - from innerjoin where orderby limit select - 1"() {
         assertGinqScript '''
             assert [[4, 4], [3, 3]] == GQ {
@@ -6058,8 +6085,8 @@ class GinqTest {
         '''
     }
 
-    @Test
-    void "testGinq - shutdown - 0"() {
+    @AfterClass
+    static void "testGinq - shutdown - 0"() {
         assertScript '''
             import org.apache.groovy.ginq.provider.collection.runtime.QueryableHelper
 // tag::ginq_tips_09[]
@@ -6071,8 +6098,8 @@ class GinqTest {
         '''
     }
 
-    @Test
-    void "testGinq - shutdown - 1"() {
+    @AfterClass
+    static void "testGinq - shutdown - 1"() {
         assertScript '''
             import org.apache.groovy.ginq.provider.collection.runtime.QueryableHelper
 // tag::ginq_tips_10[]
@@ -6084,8 +6111,8 @@ class GinqTest {
         '''
     }
 
-    @Test
-    void "testGinq - shutdown - 2"() {
+    @AfterClass
+    static void "testGinq - shutdown - 2"() {
         assertScript '''
             import org.apache.groovy.ginq.provider.collection.runtime.QueryableHelper
 // tag::ginq_tips_11[]