groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject groovy git commit: Add more tests
Date Wed, 17 Jan 2018 07:23:48 GMT
Repository: groovy
Updated Branches:
  refs/heads/native-lambda 6bf63025e -> fceb84f2b


Add more tests


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/fceb84f2
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/fceb84f2
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/fceb84f2

Branch: refs/heads/native-lambda
Commit: fceb84f2bcba17984589d661d466655ad8ad762d
Parents: 6bf6302
Author: sunlan <sunlan@apache.org>
Authored: Wed Jan 17 15:23:36 2018 +0800
Committer: sunlan <sunlan@apache.org>
Committed: Wed Jan 17 15:23:36 2018 +0800

----------------------------------------------------------------------
 src/test/groovy/transform/stc/LambdaTest.groovy | 48 +++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/fceb84f2/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 79cb71f..61021c3 100644
--- a/src/test/groovy/transform/stc/LambdaTest.groovy
+++ b/src/test/groovy/transform/stc/LambdaTest.groovy
@@ -283,7 +283,7 @@ TestScript0.groovy: 14: [Static type checking] - Cannot find matching
method jav
         '''
     }
 
-    void testFunctionWithLocalVariables5() {
+    void testFunctionWithInstanceMethodCall() {
         assertScript '''
         import groovy.transform.CompileStatic
         import java.util.stream.Collectors
@@ -305,4 +305,50 @@ TestScript0.groovy: 14: [Static type checking] - Cannot find matching
method jav
         }
         '''
     }
+
+    void testFunctionWithInstanceMethodCall2() {
+        assertScript '''
+        import groovy.transform.CompileStatic
+        import java.util.stream.Collectors
+        import java.util.stream.Stream
+        
+        @CompileStatic
+        public class Test4 {
+            public static void main(String[] args) {
+                new Test4().p();
+            }
+        
+            public void p() {
+                assert ['Hello Jochen', 'Hello Daniel'] == Stream.of("Jochen", "Daniel").map(e
-> this.hello() + e).collect(Collectors.toList());
+            }
+        
+            public String hello() {
+                return "Hello ";
+            }
+        }
+        '''
+    }
+
+    void testFunctionWithInstanceMethodCall3() {
+        assertScript '''
+        import groovy.transform.CompileStatic
+        import java.util.stream.Collectors
+        import java.util.stream.Stream
+        
+        @CompileStatic
+        public class Test4 {
+            public static void main(String[] args) {
+                new Test4().p();
+            }
+        
+            public void p() {
+                assert ['Hello Jochen', 'Hello Daniel'] == Stream.of("Jochen", "Daniel").map(e
-> hello(e)).collect(Collectors.toList());
+            }
+        
+            public String hello(String name) {
+                return "Hello $name";
+            }
+        }
+        '''
+    }
 }


Mime
View raw message