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 2020/10/08 11:58:48 UTC
[groovy] branch GROOVY-8258 updated: GROOVY-8258: make keywords
lowercase to avoid conflicts with DGM, e.g. groupBy
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 287f6ef GROOVY-8258: make keywords lowercase to avoid conflicts with DGM, e.g. groupBy
287f6ef is described below
commit 287f6efe593d55103a7cac8e8821e7f94f8f6593
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Oct 8 19:58:15 2020 +0800
GROOVY-8258: make keywords lowercase to avoid conflicts with DGM, e.g. groupBy
---
.../org/apache/groovy/linq/dsl/GinqAstBuilder.java | 2 +-
.../groovy/linq/dsl/expression/JoinExpression.java | 4 +-
.../linq/provider/collection/GinqAstWalker.groovy | 2 +-
.../org/apache/groovy/linq/GinqErrorTest.groovy | 6 +-
.../groovy/org/apache/groovy/linq/GinqTest.groovy | 236 ++++++++++-----------
5 files changed, 125 insertions(+), 125 deletions(-)
diff --git a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/GinqAstBuilder.java b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/GinqAstBuilder.java
index 07292ff..5b9fa5d 100644
--- a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/GinqAstBuilder.java
+++ b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/GinqAstBuilder.java
@@ -140,7 +140,7 @@ public class GinqAstBuilder extends CodeVisitorSupport implements SyntaxErrorRep
return;
}
- if ("orderBy".equals(methodName)) {
+ if ("orderby".equals(methodName)) {
OrderExpression orderExpression = new OrderExpression(call.getArguments());
orderExpression.setSourcePosition(call);
diff --git a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/expression/JoinExpression.java b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/expression/JoinExpression.java
index 7f4b789..367e60d 100644
--- a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/expression/JoinExpression.java
+++ b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/dsl/expression/JoinExpression.java
@@ -30,8 +30,8 @@ import java.util.List;
* @since 4.0.0
*/
public class JoinExpression extends DataSourceExpression {
- private static final String CROSS_JOIN = "crossJoin";
- private static final List<String> JOIN_NAME_LIST = Arrays.asList("innerJoin", "leftJoin", "rightJoin", "fullJoin", CROSS_JOIN);
+ private static final String CROSS_JOIN = "crossjoin";
+ private static final List<String> JOIN_NAME_LIST = Arrays.asList("innerjoin", "leftjoin", "rightjoin", "fulljoin", CROSS_JOIN);
private final String joinName;
public JoinExpression(String joinName, Expression aliasExpr, Expression dataSourceExpr) {
diff --git a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/GinqAstWalker.groovy b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/GinqAstWalker.groovy
index 33ec32c..d1e99cc 100644
--- a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/GinqAstWalker.groovy
+++ b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/GinqAstWalker.groovy
@@ -201,7 +201,7 @@ class GinqAstWalker implements GinqVisitor<Object>, SyntaxErrorReportable {
Expression receiver, Expression receiverAliasExpr, JoinExpression joinExpression,
OnExpression onExpression, WhereExpression whereExpression) {
MethodCallExpression resultMethodCallExpression
- MethodCallExpression joinMethodCallExpression = callX(receiver, joinExpression.joinName,
+ MethodCallExpression joinMethodCallExpression = callX(receiver, joinExpression.joinName.replace('join', 'Join'),
args(
constructFromMethodCallExpression(joinExpression.dataSourceExpr),
null == onExpression ? EmptyExpression.INSTANCE : lambdaX(
diff --git a/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqErrorTest.groovy b/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqErrorTest.groovy
index 0fedabd..8074604 100644
--- a/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqErrorTest.groovy
+++ b/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/GinqErrorTest.groovy
@@ -65,18 +65,18 @@ class GinqErrorTest {
}
@Test
- void "testGinq - from innerJoin select - 1"() {
+ void "testGinq - from innerjoin select - 1"() {
def err = shouldFail '''\
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[1, 1], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
select n1, n2
}.toList()
'''
- assert err.toString().contains('`on` clause is expected for `innerJoin` @ line 5, column 17.')
+ assert err.toString().contains('`on` clause is expected for `innerjoin` @ line 5, column 17.')
}
}
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 0b4a043..5ee2349 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
@@ -156,13 +156,13 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 1"() {
+ void "testGinq - from innerjoin select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[1, 1], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -170,13 +170,13 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 2"() {
+ void "testGinq - from innerjoin select - 2"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[2, 1], [3, 2], [4, 3]] == GINQ {
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
select n1 + 1, n2
}.toList()
@@ -184,13 +184,13 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 3"() {
+ void "testGinq - from innerjoin select - 3"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[1, 2], [2, 3], [3, 4]] == GINQ {
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
select n1, n2 + 1
}.toList()
@@ -198,13 +198,13 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 4"() {
+ void "testGinq - from innerjoin select - 4"() {
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
+ innerjoin n2 in nums2
on n1 + 1 == n2
select n1, n2
}.toList()
@@ -212,18 +212,18 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 5"() {
+ 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
+ from n1 in nums1 innerjoin n2 in nums2 on n1 + 1 == n2 select n1, n2
}.toList()
'''
}
@Test
- void "testGinq - from innerJoin select - 6"() {
+ void "testGinq - from innerjoin select - 6"() {
assertScript '''
class Person {
String name
@@ -239,7 +239,7 @@ class GinqTest {
def persons2 = [new Person('Jack', 35), new Person('Rose', 21), new Person('Smith', 30)]
assert [['Daniel', 'Jack'], ['Linda', 'Rose'], ['Peter', 'Smith']] == GINQ {
from p1 in persons1
- innerJoin p2 in persons2
+ innerjoin p2 in persons2
on p1.age == p2.age
select p1.name, p2.name
}.toList()
@@ -247,7 +247,7 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 7"() {
+ void "testGinq - from innerjoin select - 7"() {
assertScript '''
class Person {
String name
@@ -263,7 +263,7 @@ class GinqTest {
def persons2 = [new Person('Jack', 35), new Person('Rose', 21), new Person('Smith', 30)]
assert [['DANIEL', 'JACK'], ['LINDA', 'ROSE'], ['PETER', 'SMITH']] == GINQ {
from p1 in persons1
- innerJoin p2 in persons2
+ innerjoin p2 in persons2
on p1.age == p2.age
select p1.name.toUpperCase(), p2.name.toUpperCase()
}.toList()
@@ -271,7 +271,7 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 8"() {
+ void "testGinq - from innerjoin select - 8"() {
assertScript '''
class Person {
String name
@@ -289,7 +289,7 @@ class GinqTest {
def persons2 = [new Person('Jack', 35), new Person('Rose', 21), new Person('Smith', 30)]
assert [['DANIEL', 'JACK'], ['LINDA', 'ROSE'], ['PETER', 'SMITH']] == GINQ {
from p1 in persons1
- innerJoin p2 in persons2
+ innerjoin p2 in persons2
on p1.age == p2.age
select same(p1.name.toUpperCase()), same(p2.name.toUpperCase())
}.toList()
@@ -297,11 +297,11 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 9"() {
+ void "testGinq - from innerjoin select - 9"() {
assertScript '''
assert [1, 2, 3] == GINQ {
from n in [1, 2, 3]
- innerJoin k in [2, 3, 4]
+ innerjoin k in [2, 3, 4]
on n + 1 == k
select n
}.toList()
@@ -309,11 +309,11 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin select - 10"() {
+ void "testGinq - from innerjoin select - 10"() {
assertScript '''
assert [2, 3, 4] == GINQ {
from n in [1, 2, 3]
- innerJoin k in [2, 3, 4]
+ innerjoin k in [2, 3, 4]
on n + 1 == k
select k
}.toList()
@@ -321,13 +321,13 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin where select - 1"() {
+ void "testGinq - from innerjoin where select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[2, 2], [3, 3]] == GINQ {
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
where n1 > 1 && n2 <= 3
select n1, n2
@@ -336,13 +336,13 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin where select - 2"() {
+ void "testGinq - from innerjoin where select - 2"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[2, 2], [3, 3]] == GINQ {
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
where Math.pow(n1, 1) > 1 && Math.pow(n2, 1) <= 3
select n1, n2
@@ -351,18 +351,18 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin where select - 3"() {
+ void "testGinq - from innerjoin where select - 3"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[2, 2], [3, 3]] == GINQ {
- from n1 in nums1 innerJoin n2 in nums2 on n1 == n2 where Math.pow(n1, 1) > 1 && Math.pow(n2, 1) <= 3 select n1, n2
+ from n1 in nums1 innerjoin n2 in nums2 on n1 == n2 where Math.pow(n1, 1) > 1 && Math.pow(n2, 1) <= 3 select n1, n2
}.toList()
'''
}
@Test
- void "testGinq - from innerJoin where select - 4"() {
+ void "testGinq - from innerjoin where select - 4"() {
assertScript '''
class Person {
String name
@@ -378,7 +378,7 @@ class GinqTest {
def persons2 = [new Person('Jack', 35), new Person('Rose', 21), new Person('Smith', 30)]
assert [['Daniel', 'Jack']] == GINQ {
from p1 in persons1
- innerJoin p2 in persons2
+ innerjoin p2 in persons2
on p1.age == p2.age
where p1.name.startsWith('D') && p2.name.endsWith('k')
select p1.name, p2.name
@@ -387,7 +387,7 @@ class GinqTest {
}
@Test
- void "testGinq - from innerJoin where select - 5"() {
+ void "testGinq - from innerjoin where select - 5"() {
assertScript '''
class Person {
String name
@@ -405,7 +405,7 @@ class GinqTest {
def persons2 = [new Person('Jack', 35), new Person('Rose', 21), new Person('Smith', 30)]
assert [['Daniel', 'Jack']] == GINQ {
from p1 in persons1
- innerJoin p2 in persons2
+ innerjoin p2 in persons2
on p1.age == p2.age
where same(p1.name.startsWith('D')) && same(p2.name.endsWith('k'))
select p1.name, p2.name
@@ -479,7 +479,7 @@ class GinqTest {
assert [[3, 3], [5, 5]] == GINQ {
from v in (
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
where n1 > 1 && n2 <= 5
select n1, n2
@@ -498,7 +498,7 @@ class GinqTest {
assert [[3, 3], [5, 5]] == GINQ {
from v in (
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
where n1 > 1 && n2 <= 5
select n1, n2
@@ -517,7 +517,7 @@ class GinqTest {
assert [[3, 3], [5, 5]] == GINQ {
from v in (
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
where n1 > 1 && n2 <= 5
select n1, n2
@@ -536,7 +536,7 @@ class GinqTest {
assert [[3, 3], [5, 5]] == GINQ {
from v in (
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
where n1 > 1 && n2 <= 5
select n1 as vn1, n2 as vn2 // rename column names
@@ -555,7 +555,7 @@ class GinqTest {
assert [[3, 3], [5, 5]] == GINQ {
from v in (
from n1 in nums1
- innerJoin n2 in nums2
+ innerjoin n2 in nums2
on n1 == n2
where n1 > 1 && n2 <= 5
select ((n1 as Integer) as vn1), ((n2 as Integer) as vn2)
@@ -643,7 +643,7 @@ class GinqTest {
from m in [1, 2, 3]
select m as v1, (m + 1) as v2
)
- innerJoin k in [2, 3, 4]
+ innerjoin k in [2, 3, 4]
on n.v2 == k
where n.v2 < 4
select n.v1 * k
@@ -658,7 +658,7 @@ class GinqTest {
assertScript '''
assert [2, 3] == GINQ {
from n in [1, 2, 3]
- innerJoin k in (
+ innerjoin k in (
from m in [2, 3, 4]
select m
)
@@ -669,13 +669,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 1"() {
+ void "testGinq - from leftjoin select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[1, 1], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -683,13 +683,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 2"() {
+ void "testGinq - from leftjoin select - 2"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [2, 3, 4]
assert [[1, null], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -697,13 +697,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 3"() {
+ void "testGinq - from leftjoin select - 3"() {
assertScript '''
def nums1 = [1, 2, 3, null]
def nums2 = [2, 3, 4]
assert [[1, null], [2, 2], [3, 3], [null, null]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -711,13 +711,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 4"() {
+ void "testGinq - from leftjoin select - 4"() {
assertScript '''
def nums1 = [1, 2, 3, null]
def nums2 = [2, 3, 4, null]
assert [[1, null], [2, 2], [3, 3], [null, null]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -725,13 +725,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 5"() {
+ void "testGinq - from leftjoin select - 5"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [2, 3, 4, null]
assert [[1, null], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -739,13 +739,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 6"() {
+ void "testGinq - from leftjoin select - 6"() {
assertScript '''
def nums1 = [1, 2, 3, null, null]
def nums2 = [2, 3, 4]
assert [[1, null], [2, 2], [3, 3], [null, null], [null, null]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -753,13 +753,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 7"() {
+ void "testGinq - from leftjoin select - 7"() {
assertScript '''
def nums1 = [1, 2, 3, null, null]
def nums2 = [2, 3, 4, null]
assert [[1, null], [2, 2], [3, 3], [null, null], [null, null]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -767,13 +767,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 8"() {
+ void "testGinq - from leftjoin select - 8"() {
assertScript '''
def nums1 = [1, 2, 3, null, null]
def nums2 = [2, 3, 4, null, null]
assert [[1, null], [2, 2], [3, 3], [null, null], [null, null]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -781,13 +781,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 9"() {
+ void "testGinq - from leftjoin select - 9"() {
assertScript '''
def nums1 = [1, 2, 3, null]
def nums2 = [2, 3, 4, null, null]
assert [[1, null], [2, 2], [3, 3], [null, null]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -795,13 +795,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin select - 10"() {
+ void "testGinq - from leftjoin select - 10"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [2, 3, 4, null, null]
assert [[1, null], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -809,13 +809,13 @@ class GinqTest {
}
@Test
- void "testGinq - from leftJoin where select - 1"() {
+ void "testGinq - from leftjoin where select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [2, 3, 4, null, null]
assert [[2, 2], [3, 3]] == GINQ {
from n1 in nums1
- leftJoin n2 in nums2
+ leftjoin n2 in nums2
on n1 == n2
where n2 != null
select n1, n2
@@ -824,13 +824,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 1"() {
+ void "testGinq - from rightjoin select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [1, 2, 3]
assert [[1, 1], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -838,13 +838,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 2"() {
+ void "testGinq - from rightjoin select - 2"() {
assertScript '''
def nums2 = [1, 2, 3]
def nums1 = [2, 3, 4]
assert [[null, 1], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -852,13 +852,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 3"() {
+ void "testGinq - from rightjoin select - 3"() {
assertScript '''
def nums2 = [1, 2, 3, null]
def nums1 = [2, 3, 4]
assert [[null, 1], [2, 2], [3, 3], [null, null]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -866,13 +866,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 4"() {
+ void "testGinq - from rightjoin select - 4"() {
assertScript '''
def nums2 = [1, 2, 3, null]
def nums1 = [2, 3, 4, null]
assert [[null, 1], [2, 2], [3, 3], [null, null]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -880,13 +880,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 5"() {
+ void "testGinq - from rightjoin select - 5"() {
assertScript '''
def nums2 = [1, 2, 3]
def nums1 = [2, 3, 4, null]
assert [[null, 1], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -894,13 +894,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 6"() {
+ void "testGinq - from rightjoin select - 6"() {
assertScript '''
def nums2 = [1, 2, 3, null, null]
def nums1 = [2, 3, 4]
assert [[null, 1], [2, 2], [3, 3], [null, null], [null, null]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -908,13 +908,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 7"() {
+ void "testGinq - from rightjoin select - 7"() {
assertScript '''
def nums2 = [1, 2, 3, null, null]
def nums1 = [2, 3, 4, null]
assert [[null, 1], [2, 2], [3, 3], [null, null], [null, null]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -922,13 +922,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 8"() {
+ void "testGinq - from rightjoin select - 8"() {
assertScript '''
def nums2 = [1, 2, 3, null, null]
def nums1 = [2, 3, 4, null, null]
assert [[null, 1], [2, 2], [3, 3], [null, null], [null, null]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -936,13 +936,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 9"() {
+ void "testGinq - from rightjoin select - 9"() {
assertScript '''
def nums2 = [1, 2, 3, null]
def nums1 = [2, 3, 4, null, null]
assert [[null, 1], [2, 2], [3, 3], [null, null]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -950,13 +950,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin select - 10"() {
+ void "testGinq - from rightjoin select - 10"() {
assertScript '''
def nums2 = [1, 2, 3]
def nums1 = [2, 3, 4, null, null]
assert [[null, 1], [2, 2], [3, 3]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -964,13 +964,13 @@ class GinqTest {
}
@Test
- void "testGinq - from rightJoin where select - 1"() {
+ void "testGinq - from rightjoin where select - 1"() {
assertScript '''
def nums2 = [1, 2, 3]
def nums1 = [2, 3, 4, null, null]
assert [[2, 2], [3, 3]] == GINQ {
from n1 in nums1
- rightJoin n2 in nums2
+ rightjoin n2 in nums2
on n1 == n2
where n1 != null
select n1, n2
@@ -979,13 +979,13 @@ class GinqTest {
}
@Test
- void "testGinq - from fullJoin select - 1"() {
+ void "testGinq - from fulljoin select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [2, 3, 4]
assert [[1, null], [2, 2], [3, 3], [null, 4]] == GINQ {
from n1 in nums1
- fullJoin n2 in nums2
+ fulljoin n2 in nums2
on n1 == n2
select n1, n2
}.toList()
@@ -993,13 +993,13 @@ class GinqTest {
}
@Test
- void "testGinq - from fullJoin where select - 1"() {
+ void "testGinq - from fulljoin where select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [2, 3, 4]
assert [[2, 2], [3, 3]] == GINQ {
from n1 in nums1
- fullJoin n2 in nums2
+ fulljoin n2 in nums2
on n1 == n2
where n1 != null && n2 != null
select n1, n2
@@ -1008,26 +1008,26 @@ class GinqTest {
}
@Test
- void "testGinq - from crossJoin select - 1"() {
+ void "testGinq - from crossjoin select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [3, 4, 5]
assert [[1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 3], [3, 4], [3, 5]] == GINQ {
from n1 in nums1
- crossJoin n2 in nums2
+ crossjoin n2 in nums2
select n1, n2
}.toList()
'''
}
@Test
- void "testGinq - from crossJoin where select - 1"() {
+ void "testGinq - from crossjoin where select - 1"() {
assertScript '''
def nums1 = [1, 2, 3]
def nums2 = [3, 4, 5]
assert [[3, 3], [3, 5]] == GINQ {
from n1 in nums1
- crossJoin n2 in nums2
+ crossjoin n2 in nums2
where n1 > 2 && n2 != 4
select n1, n2
}.toList()
@@ -1035,18 +1035,18 @@ class GinqTest {
}
@Test
- void "testGinq - from orderBy select - 1"() {
+ void "testGinq - from orderby select - 1"() {
assertScript '''
assert [1, 2, 5, 6] == GINQ {
from n in [1, 5, 2, 6]
- orderBy n
+ orderby n
select n
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 2"() {
+ void "testGinq - from orderby select - 2"() {
assertScript '''
@groovy.transform.EqualsAndHashCode
class Person {
@@ -1061,14 +1061,14 @@ class GinqTest {
def persons = [new Person('Linda', 21), new Person('Daniel', 35), new Person('David', 21)]
assert [new Person('Daniel', 35), new Person('Linda', 21), new Person('David', 21)] == GINQ {
from p in persons
- orderBy p.age in desc
+ orderby p.age in desc
select p
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 3"() {
+ void "testGinq - from orderby select - 3"() {
assertScript '''
@groovy.transform.EqualsAndHashCode
class Person {
@@ -1083,14 +1083,14 @@ class GinqTest {
def persons = [new Person('Linda', 21), new Person('Daniel', 35), new Person('David', 21)]
assert [new Person('Daniel', 35), new Person('David', 21), new Person('Linda', 21)] == GINQ {
from p in persons
- orderBy p.age in desc, p.name
+ orderby p.age in desc, p.name
select p
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 4"() {
+ void "testGinq - from orderby select - 4"() {
assertScript '''
@groovy.transform.EqualsAndHashCode
class Person {
@@ -1105,14 +1105,14 @@ class GinqTest {
def persons = [new Person('Linda', 21), new Person('Daniel', 35), new Person('David', 21)]
assert [new Person('Daniel', 35), new Person('David', 21), new Person('Linda', 21)] == GINQ {
from p in persons
- orderBy p.age in desc, p.name in asc
+ orderby p.age in desc, p.name in asc
select p
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 5"() {
+ void "testGinq - from orderby select - 5"() {
assertScript '''
@groovy.transform.EqualsAndHashCode
class Person {
@@ -1127,14 +1127,14 @@ class GinqTest {
def persons = [new Person('Linda', 21), new Person('Daniel', 35), new Person('David', 21)]
assert [new Person('Daniel', 35), new Person('Linda', 21), new Person('David', 21)] == GINQ {
from p in persons
- orderBy p.age in desc, p.name in desc
+ orderby p.age in desc, p.name in desc
select p
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 6"() {
+ void "testGinq - from orderby select - 6"() {
assertScript '''
@groovy.transform.EqualsAndHashCode
class Person {
@@ -1149,14 +1149,14 @@ class GinqTest {
def persons = [new Person('Linda', 21), new Person('Daniel', 35), new Person('David', 21)]
assert [new Person('Linda', 21), new Person('David', 21), new Person('Daniel', 35)] == GINQ {
from p in persons
- orderBy p.age, p.name in desc
+ orderby p.age, p.name in desc
select p
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 7"() {
+ void "testGinq - from orderby select - 7"() {
assertScript '''
@groovy.transform.EqualsAndHashCode
class Person {
@@ -1171,68 +1171,68 @@ class GinqTest {
def persons = [new Person('Linda', 21), new Person('Daniel', 35), new Person('David', 21)]
assert [new Person('Linda', 21), new Person('David', 21), new Person('Daniel', 35)] == GINQ {
from p in persons
- orderBy p.age in asc, p.name in desc
+ orderby p.age in asc, p.name in desc
select p
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 8"() {
+ void "testGinq - from orderby select - 8"() {
assertScript '''
assert [1, 2, 5, 6] == GINQ {
from n in [1, 5, 2, 6]
- orderBy 1 / n in desc
+ orderby 1 / n in desc
select n
}.toList()
'''
}
@Test
- void "testGinq - from orderBy select - 9"() {
+ void "testGinq - from orderby select - 9"() {
assertScript '''
assert [1, 2, 5, 6] == GINQ {
from n in [1, 5, 2, 6]
- orderBy Math.pow(1 / n, 1) in desc
+ orderby Math.pow(1 / n, 1) in desc
select n
}.toList()
'''
}
@Test
- void "testGinq - from innerJoin orderBy select - 1"() {
+ void "testGinq - from innerjoin orderby select - 1"() {
assertScript '''
assert [2, 3] == GINQ {
from n1 in [1, 2, 3]
- innerJoin n2 in [2, 3, 4]
+ innerjoin n2 in [2, 3, 4]
on n1 == n2
- orderBy n1
+ orderby n1
select n2
}.toList()
'''
}
@Test
- void "testGinq - from innerJoin orderBy select - 2"() {
+ void "testGinq - from innerjoin orderby select - 2"() {
assertScript '''
assert [3, 2] == GINQ {
from n1 in [1, 2, 3]
- innerJoin n2 in [2, 3, 4]
+ innerjoin n2 in [2, 3, 4]
on n1 == n2
- orderBy n1 in desc
+ orderby n1 in desc
select n2
}.toList()
'''
}
@Test
- void "testGinq - from innerJoin orderBy select - 3"() {
+ void "testGinq - from innerjoin orderby select - 3"() {
assertScript '''
assert [[3, 3], [2, 2]] == GINQ {
from n1 in [1, 2, 3]
- innerJoin n2 in [2, 3, 4]
+ innerjoin n2 in [2, 3, 4]
on n1 == n2
- orderBy n1 in desc, n2 in desc
+ orderby n1 in desc, n2 in desc
select n1, n2
}.toList()
'''
@@ -1266,10 +1266,10 @@ class GinqTest {
assert expected == GINQ {
from p in json.persons
- innerJoin t in json.tasks
+ innerjoin t in json.tasks
on t.assignee == p.id
where t.id in [1, 3, 4]
- orderBy t.manDay in desc
+ orderby t.manDay in desc
select (taskId: t.id, taskContent: t.content, assignee: p.name, manDay: t.manDay)
}.toList()
}