You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2022/12/01 14:01:36 UTC
[groovy] branch master updated: GROOVY-10813: add test case
This is an automated email from the ASF dual-hosted git repository.
emilles 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 9ab958af12 GROOVY-10813: add test case
9ab958af12 is described below
commit 9ab958af1296364750359757564492cdd713f3f5
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Thu Dec 1 08:01:22 2022 -0600
GROOVY-10813: add test case
---
.../groovy/transform/stc/MethodReferenceTest.groovy | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/test/groovy/transform/stc/MethodReferenceTest.groovy b/src/test/groovy/transform/stc/MethodReferenceTest.groovy
index 6070c93777..0a9c5d3ae7 100644
--- a/src/test/groovy/transform/stc/MethodReferenceTest.groovy
+++ b/src/test/groovy/transform/stc/MethodReferenceTest.groovy
@@ -66,8 +66,8 @@ final class MethodReferenceTest {
void test() {
List<String> list = ['a','bc','def']
Function<String,String> self = str -> str // help for toMap
- def map = list.stream().collect(Collectors.toMap(self, String::length))
- assert map == [a: 1, bc: 2, 'def': 3]
+ def result = list.stream().collect(Collectors.toMap(self, String::length))
+ assert result == [a: 1, bc: 2, 'def': 3]
}
test()
@@ -835,7 +835,7 @@ final class MethodReferenceTest {
@CompileStatic
void test() {
def result = ['a', 'ab', 'abc'].stream().map(String::size).collect(Collectors.toList())
- assert [1, 2, 3] == result
+ assert result == [1, 2, 3]
}
test()
@@ -861,7 +861,6 @@ final class MethodReferenceTest {
@CompileStatic
void test() {
def result = [[a:1], [b:2], [c:3]].stream().map(Object::toString).collect(Collectors.toList())
- assert result.size() == 3
assert result == ['[a:1]', '[b:2]', '[c:3]']
}
@@ -970,6 +969,16 @@ final class MethodReferenceTest {
c.accept(this, 'hello world!')
}
+ test()
+ '''
+ assertScript shell, '''
+ @CompileStatic
+ void test() {
+ Supplier<String> s = 'x'::toString
+ def result = s.get()
+ assert result == 'x'
+ }
+
test()
'''
}