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/06/29 21:03:12 UTC

[groovy] branch master updated: GROOVY-10673: test without `@Grab`

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 6c6a267bc9 GROOVY-10673: test without `@Grab`
6c6a267bc9 is described below

commit 6c6a267bc92f81d56e0f5c41d59561cb945b08fc
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed Jun 29 16:03:00 2022 -0500

    GROOVY-10673: test without `@Grab`
---
 build.bat                                          |  1 +
 .../stc/ClosureParamTypeInferenceSTCTest.groovy    | 18 ++++++++++++++++
 .../groovy/transform/stc/GenericsSTCTest.groovy    | 24 ----------------------
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/build.bat b/build.bat
new file mode 100644
index 0000000000..8dcd28a383
--- /dev/null
+++ b/build.bat
@@ -0,0 +1 @@
+.\gradlew --max-workers 1 --no-build-cache --no-daemon --no-scan %*
diff --git a/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy b/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy
index 5a383038aa..b7ea2cb3a6 100644
--- a/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy
+++ b/src/test/groovy/transform/stc/ClosureParamTypeInferenceSTCTest.groovy
@@ -1522,4 +1522,22 @@ class ClosureParamTypeInferenceSTCTest extends StaticTypeCheckingTestCase {
             m((text, item) -> { })
         '''
     }
+
+    void testGroovy10673() {
+        assertScript '''import java.util.function.Consumer
+
+            void proc(Consumer<Number> action) {
+                action.accept(1.2345)
+            }
+
+            int i = 0
+            proc { n ->
+                def c = {
+                    i = n.intValue()
+                }
+                c()
+            }
+            assert i == 1
+        '''
+    }
 }
diff --git a/src/test/groovy/transform/stc/GenericsSTCTest.groovy b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
index 251b7368f7..a5762380cf 100644
--- a/src/test/groovy/transform/stc/GenericsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/GenericsSTCTest.groovy
@@ -4824,30 +4824,6 @@ class GenericsSTCTest extends StaticTypeCheckingTestCase {
         '''
     }
 
-    // GROOVY-10653
-    void testMockito() {
-        assertScript '''
-            @Grab('org.mockito:mockito-core:4.5.1')
-            import static org.mockito.Mockito.*
-
-            class C {
-                String string
-            }
-            interface I {
-                C f(String s)
-            }
-
-            def i = mock(I)
-            when(i.f(anyString())).thenAnswer { /*InvocationOnMock*/ iom ->
-              //new C(string: iom.arguments[0]) works
-                new C().tap {
-                    string = iom.arguments[0]
-                }
-            }
-            assert i.f('x') instanceof C
-        '''
-    }
-
     //--------------------------------------------------------------------------
 
     static class MyList