You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/10/23 11:57:51 UTC
groovy git commit: fix wrong split for jdk8+ parts of test
Repository: groovy
Updated Branches:
refs/heads/GROOVY_2_6_X 5861d8106 -> ff2c826a9
fix wrong split for jdk8+ parts of test
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/ff2c826a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ff2c826a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ff2c826a
Branch: refs/heads/GROOVY_2_6_X
Commit: ff2c826a94c7e6c3023baf7a910bdb9a609a17fc
Parents: 5861d81
Author: paulk <pa...@asert.com.au>
Authored: Mon Oct 23 21:57:10 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Mon Oct 23 21:57:10 2017 +1000
----------------------------------------------------------------------
.../resources/core/MethodReference_01x.groovy | 31 -----------------
.../core/MethodReference_01x_1_8.groovy | 35 ++++++++++++++++++--
2 files changed, 32 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/ff2c826a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy
index dfeede3..a04f305 100644
--- a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy
+++ b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x.groovy
@@ -17,37 +17,6 @@
* under the License.
*/
-def robot = new Robot()
-
-class BasePerson {
- static String getText(Person p) {
- return p.name
- }
-}
-
-class Person extends BasePerson {
- private String name
-
- Person(String name) {
- this.name = name
- }
-
- String getName() {
- return this.name
- }
-
-}
-
-class Robot {
- String greet(Person p) {
- return "Hi, ${p.name}"
- }
-
- static char firstCharOfName(Person p) {
- return p.getName().charAt(0)
- }
-}
-
def mr = String::toUpperCase
assert 'ABC' == mr('abc')
assert 'ABC' == String::toUpperCase('abc')
http://git-wip-us.apache.org/repos/asf/groovy/blob/ff2c826a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_8.groovy
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_8.groovy b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_8.groovy
index 617c20a..9dbd6bd 100644
--- a/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_8.groovy
+++ b/subprojects/parser-antlr4/src/test/resources/core/MethodReference_01x_1_8.groovy
@@ -20,6 +20,37 @@
// additional tests that use jdk8 api calls
import java.util.stream.Collectors
+import java.util.stream.Stream
+
+def robot = new Robot()
+
+class BasePerson {
+ static String getText(Person p) {
+ return p.name
+ }
+}
+
+class Person extends BasePerson {
+ private String name
+
+ Person(String name) {
+ this.name = name
+ }
+
+ String getName() {
+ return this.name
+ }
+}
+
+class Robot {
+ String greet(Person p) {
+ return "Hi, ${p.name}"
+ }
+
+ static char firstCharOfName(Person p) {
+ return p.getName().charAt(0)
+ }
+}
// class::staticMethod
assert ['1', '2', '3'] == [1, 2, 3].stream().map(Integer::toString).collect(Collectors.toList())
@@ -27,7 +58,6 @@ assert ['1', '2', '3'] == [1, 2, 3].stream().map(Integer::toString).collect(Coll
// class::instanceMethod
assert ['A', 'B', 'C'] == ['a', 'b', 'c'].stream().map(String::toUpperCase).collect(Collectors.toList())
-
// instance::instanceMethod
assert ['Hi, Jochen', 'Hi, Paul', 'Hi, Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(robot::greet).collect(Collectors.toList())
@@ -42,8 +72,7 @@ assert ['J', 'P', 'D'] == [new Person('Jochen'), new Person('Paul'), new Person(
assert ['Jochen', 'Paul', 'Daniel'] == [new Person('Jochen'), new Person('Paul'), new Person('Daniel')].stream().map(Person::getName).collect(Collectors.toList())
// class::instanceMethod
-assert 6 == java.util.stream.Stream.of(1, 2, 3).reduce(0, BigDecimal::add)
-
+assert 6 == Stream.of(1, 2, 3).reduce(0, BigDecimal::add)
assert [new String[1], new String[2], new String[3]] == [1, 2, 3].stream().map(String[]::new).collect(Collectors.toList())
assert [1, 2, 3] as String[] == [1, 2, 3].stream().map(String::valueOf).toArray(String[]::new)