Repository: groovy Updated Branches: refs/heads/native-lambda 083089fc3 -> 61474c1ee
Add one more test for script Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/61474c1e Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/61474c1e Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/61474c1e Branch: refs/heads/native-lambda Commit: 61474c1ee9b6d9d042abc0f138c234fce219216a Parents: 083089f Author: sunlan <[email protected]> Authored: Sat Jan 13 00:33:44 2018 +0800 Committer: sunlan <[email protected]> Committed: Sat Jan 13 00:33:44 2018 +0800 ---------------------------------------------------------------------- src/test/groovy/transform/stc/LambdaTest.groovy | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/61474c1e/src/test/groovy/transform/stc/LambdaTest.groovy ---------------------------------------------------------------------- diff --git a/src/test/groovy/transform/stc/LambdaTest.groovy b/src/test/groovy/transform/stc/LambdaTest.groovy index 700f9cd..ba471fb 100644 --- a/src/test/groovy/transform/stc/LambdaTest.groovy +++ b/src/test/groovy/transform/stc/LambdaTest.groovy @@ -39,8 +39,7 @@ class LambdaTest extends GroovyTestCase { ''' } - /* - void testFunction2() { + void testFunctionScript() { assertScript ''' import groovy.transform.CompileStatic import java.util.stream.Collectors @@ -48,20 +47,22 @@ class LambdaTest extends GroovyTestCase { @CompileStatic void p() { - assert [2, 3, 4] == Stream.of(1, 2, 3).map(e -> e.plus 1).collect(Collectors.toList()); + assert [2, 3, 4] == Stream.of(1, 2, 3).map(e -> e + 1).collect(Collectors.toList()); } p() ''' } - */ + /** + * Depends on https://issues.apache.org/jira/browse/GROOVY-8445 + */ void testBinaryOperator() { - if (true) return; + if (true) return // the test can pass only in dynamic mode now, it can not pass static type checking... - /* TODO + /* FIXME TestScript0.groovy: 13: [Static type checking] - Cannot find matching method java.util.stream.Stream#reduce(int, groovy.lang.Closure). Please check if the declared type is correct and if the method exists. @ line 13, column 30. assert 13 == Stream.of(1, 2, 3).reduce(7, (r, e) -> r + e); @@ -134,10 +135,13 @@ TestScript0.groovy: 13: [Static type checking] - Cannot find matching method jav ''' } + /** + * Depends on https://issues.apache.org/jira/browse/GROOVY-8445 + */ void testUnaryOperator() { - if (true) return; + if (true) return - /* TODO + /* FIXME TestScript0.groovy: 14: [Static type checking] - Cannot find matching method java.util.List#replaceAll(groovy.lang.Closure). Please check if the declared type is correct and if the method exists. @ line 14, column 17. list.replaceAll(e -> e + 10)
