This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY-8258
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY-8258 by this push:
new d1f7660 GROOVY-8258: add more test cases for ginq in 1 line
d1f7660 is described below
commit d1f76603c7570dc984445c810514811ed43e1b0f
Author: Daniel Sun <[email protected]>
AuthorDate: Tue Oct 6 22:24:06 2020 +0800
GROOVY-8258: add more test cases for ginq in 1 line
---
.../groovy/org/apache/groovy/linq/GinqTest.groovy | 35 ++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git
a/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqTest.groovy
b/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqTest.groovy
index c97f09d..872c6b8 100644
---
a/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqTest.groovy
+++
b/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqTest.groovy
@@ -113,7 +113,17 @@ class GinqTest {
}
@Test
- void "testGinq - from where select"() {
+ void "testGinq - from select - 6"() {
+ assertScript '''
+ def numbers = [0, 1, 2]
+ assert [0, 1, 2] == GINQ {
+ from n in numbers select n
+ }.toList()
+ '''
+ }
+
+ @Test
+ void "testGinq - from where select - 1"() {
assertScript '''
def numbers = [0, 1, 2, 3, 4, 5]
assert [2, 4, 6] == GINQ {
@@ -125,6 +135,16 @@ class GinqTest {
}
@Test
+ void "testGinq - from where select - 2"() {
+ assertScript '''
+ def numbers = [0, 1, 2, 3, 4, 5]
+ assert [2, 4, 6] == GINQ {
+ from n in numbers where n > 0 && n <= 3 select n * 2
+ }.toList()
+ '''
+ }
+
+ @Test
void "testGinq - from innerJoin select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
@@ -183,6 +203,17 @@ class GinqTest {
@Test
void "testGinq - from innerJoin select - 5"() {
assertScript '''
+ def nums1 = [1, 2, 3]
+ def nums2 = [1, 2, 3]
+ assert [[1, 2], [2, 3]] == GINQ {
+ from n1 in nums1 innerJoin n2 in nums2 on n1 + 1 == n2 select
n1, n2
+ }.toList()
+ '''
+ }
+
+ @Test
+ void "testGinq - from innerJoin select - 6"() {
+ assertScript '''
class Person {
String name
int age
@@ -205,7 +236,7 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 6"() {
+ void "testGinq - from innerJoin select - 7"() {
assertScript '''
class Person {
String name