Repository: groovy
Updated Branches:
  refs/heads/native-lambda fceb84f2b -> 62c835b4e


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/62c835b4
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/62c835b4
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/62c835b4

Branch: refs/heads/native-lambda
Commit: 62c835b4e42071fb167934bb87176389d4cd999f
Parents: fceb84f
Author: sunlan <[email protected]>
Authored: Wed Jan 17 15:26:28 2018 +0800
Committer: sunlan <[email protected]>
Committed: Wed Jan 17 15:26:28 2018 +0800

----------------------------------------------------------------------
 src/test/groovy/transform/stc/LambdaTest.groovy | 35 +++++++++++++++++---
 1 file changed, 30 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/62c835b4/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 61021c3..afa6111 100644
--- a/src/test/groovy/transform/stc/LambdaTest.groovy
+++ b/src/test/groovy/transform/stc/LambdaTest.groovy
@@ -237,7 +237,28 @@ TestScript0.groovy: 14: [Static type checking] - Cannot 
find matching method jav
         '''
     }
 
-    void testFunctionWithLocalVariables3() {
+    void testFunctionWithLocalVariables4() {
+        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() {
+                String x = "x";
+                StringBuilder y = new StringBuilder("y");
+                assert ['yx1', 'yx2', 'yx3'] == Stream.of(1, 2, 3).map(e -> y 
+ x + e).collect(Collectors.toList());
+            }
+        }
+        '''
+    }
+
+    void testFunctionWithStaticMethodCall() {
         assertScript '''
         import groovy.transform.CompileStatic
         import java.util.stream.Collectors
@@ -262,7 +283,7 @@ TestScript0.groovy: 14: [Static type checking] - Cannot 
find matching method jav
         '''
     }
 
-    void testFunctionWithLocalVariables4() {
+    void testFunctionWithStaticMethodCall2() {
         assertScript '''
         import groovy.transform.CompileStatic
         import java.util.stream.Collectors
@@ -271,13 +292,17 @@ TestScript0.groovy: 14: [Static type checking] - Cannot 
find matching method jav
         @CompileStatic
         public class Test4 {
             public static void main(String[] args) {
-                new Test4().p();
+                p();
             }
         
-            public void p() {
+            public static void p() {
                 String x = "x";
                 StringBuilder y = new StringBuilder("y");
-                assert ['yx1', 'yx2', 'yx3'] == Stream.of(1, 2, 3).map(e -> y 
+ x + e).collect(Collectors.toList());
+                assert ['Hello yx1', 'Hello yx2', 'Hello yx3'] == Stream.of(1, 
2, 3).map(e -> Test4.hello() + y + x + e).collect(Collectors.toList());
+            }
+        
+            public static String hello() {
+                return "Hello ";
             }
         }
         '''

Reply via email to