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:38:28 UTC
[groovy] branch GROOVY_4_0_X updated: remove `@Grab` usage
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_4_0_X by this push:
new 8043cb8d70 remove `@Grab` usage
8043cb8d70 is described below
commit 8043cb8d70b41fae6e8db10340a565632700b172
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, 15 insertions(+), 15 deletions(-)
diff --git a/src/test/groovy/bugs/Groovy6932Bug.groovy b/src/test/groovy/bugs/Groovy6932.groovy
similarity index 65%
rename from src/test/groovy/bugs/Groovy6932Bug.groovy
rename to src/test/groovy/bugs/Groovy6932.groovy
index 22369a19f7..d68993ce41 100644
--- a/src/test/groovy/bugs/Groovy6932Bug.groovy
+++ b/src/test/groovy/bugs/Groovy6932.groovy
@@ -18,35 +18,35 @@
*/
package groovy.bugs
-import groovy.test.GroovyTestCase
+import org.junit.Test
-class Groovy6932Bug extends GroovyTestCase {
+import static groovy.test.GroovyAssert.assertScript
+
+final class Groovy6932 {
+ @Test
void testLoggingWithinClosuresShouldHaveGuards() {
assertScript '''
- @Grab('org.slf4j:slf4j-simple:1.7.33')
- import groovy.util.logging.Slf4j
-
- new TestCode().doSomethingThatLogs()
-
- @Slf4j
- class TestCode {
- void doSomethingThatLogs(){
+ @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()
'''
}
}