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/11 12:21:14 UTC

[groovy] 02/02: remove `@Grab` usage

This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit a8826ac4c406d46d7474439b7adb5a2ce628eccd
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sat Jun 11 07:20:58 2022 -0500

    remove `@Grab` usage
---
 .../{Groovy6932Bug.groovy => Groovy6932.groovy}    | 30 ++++++++++++----------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/test/groovy/bugs/Groovy6932Bug.groovy b/src/test/groovy/bugs/Groovy6932.groovy
similarity index 67%
rename from src/test/groovy/bugs/Groovy6932Bug.groovy
rename to src/test/groovy/bugs/Groovy6932.groovy
index 7c3420c0f7..d68993ce41 100644
--- a/src/test/groovy/bugs/Groovy6932Bug.groovy
+++ b/src/test/groovy/bugs/Groovy6932.groovy
@@ -18,33 +18,35 @@
  */
 package groovy.bugs
 
-class Groovy6932Bug extends GroovyTestCase {
-    void testLoggingWithinClosuresShouldHaveGuards() {
-        assertScript '''
-            @Grab('org.slf4j:slf4j-simple:1.7.30')
-            import groovy.util.logging.Slf4j
+import org.junit.Test
 
-            new TestCode().doSomethingThatLogs()
+import static groovy.test.GroovyAssert.assertScript
 
-            @Slf4j
-            class TestCode {
-                void doSomethingThatLogs(){
+final class Groovy6932 {
+    @Test
+    void testLoggingWithinClosuresShouldHaveGuards() {
+        assertScript '''
+            @groovy.util.logging.Log
+            class C {
+                void m() {
                     int info = 0
                     int trace = 0
-                    log.info createLogString("${info++}")
-                    log.trace createLogString("${trace++}")
-                    Closure c1 = { log.info createLogString("${info++}") }
+                    log.info(createLogString(info++))
+                    log.finest(createLogString(trace++))
+                    Closure c1 = { log.info(createLogString(info++)) }
                     c1()
-                    Closure c2 = { log.trace createLogString("${trace++}") }
+                    Closure c2 = { log.finest(createLogString(trace++)) }
                     c2()
                     assert info == 2
                     assert trace == 0
                 }
 
-                String createLogString(def p){
+                String createLogString(p) {
                     "called with $p"
                 }
             }
+
+            new C().m()
         '''
     }
 }