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 3ec2fe65db junit jupiter
3ec2fe65db is described below
commit 3ec2fe65db9b5409cfb2769a60a84bec74bc13c5
Author: Eric Milles <[email protected]>
AuthorDate: Wed Mar 4 10:22:50 2026 -0600
junit jupiter
---
src/test/groovy/NoPackageTest.groovy | 2 +
.../groovy/bugs/AmbiguousListOrMethodTest.groovy | 12 ++-
src/test/groovy/bugs/AsBoolBug.groovy | 3 +-
.../bugs/AssignmentInsideExpressionBug.groovy | 5 +-
.../groovy/bugs/AttributeSetExpressionBug.groovy | 16 ++--
.../groovy/bugs/AutoboxingOfComparisonsBug.groovy | 2 +-
.../bugs/BadLineNumberOnExceptionBugTest.groovy | 3 +-
src/test/groovy/bugs/BadScriptNameBug.groovy | 3 +-
src/test/groovy/bugs/BenchmarkBug.groovy | 5 +-
src/test/groovy/bugs/BlockAsClosureBug.groovy | 3 +-
src/test/groovy/bugs/BooleanBug.groovy | 14 ++--
src/test/groovy/bugs/ByteIndexBug.groovy | 2 +-
src/test/groovy/bugs/Bytecode2Bug.groovy | 5 +-
src/test/groovy/bugs/Bytecode3Bug.groovy | 5 +-
src/test/groovy/bugs/Bytecode4Bug.groovy | 5 +-
src/test/groovy/bugs/Bytecode5Bug.groovy | 5 +-
src/test/groovy/bugs/Bytecode6Bug.groovy | 5 +-
src/test/groovy/bugs/Bytecode7Bug.groovy | 5 +-
src/test/groovy/bugs/BytecodeBug.groovy | 5 +-
.../bugs/CallingClosuresWithClosuresBug.groovy | 5 +-
.../groovy/bugs/CastWhenUsingClosuresBug.groovy | 5 +-
src/test/groovy/bugs/ChristofsPropertyBug.groovy | 3 +-
.../groovy/bugs/ClassGeneratorFixesTest.groovy | 15 ++--
src/test/groovy/bugs/ClassInNamedParamsBug.groovy | 3 +-
src/test/groovy/bugs/ClosureInClosureBug.groovy | 3 +-
.../groovy/bugs/ClosureTypedVariableBug.groovy | 3 +-
src/test/groovy/bugs/ClosureVariableBug.groovy | 5 +-
.../bugs/ClosureWithBitwiseDefaultParamTest.groovy | 2 +-
.../bugs/ClosureWithStaticVariablesBug.groovy | 6 +-
src/test/groovy/bugs/ConstructorBug.groovy | 4 +-
src/test/groovy/bugs/ConstructorThisCallBug.groovy | 8 +-
src/test/groovy/bugs/CustomMetaClassTest.groovy | 21 +++--
src/test/groovy/bugs/DefVariableBug.groovy | 3 +-
src/test/groovy/bugs/ForLoopBug.groovy | 4 +-
src/test/groovy/bugs/FullyQualifiedClassBug.groovy | 6 +-
.../bugs/FullyQualifiedMethodReturnTypeBug.groovy | 6 +-
.../bugs/FullyQualifiedVariableTypeBug.groovy | 6 +-
src/test/groovy/bugs/GetterBug.groovy | 9 +--
src/test/groovy/bugs/Groovy10143.groovy | 1 +
.../{Groovy1018_Bug.groovy => Groovy1018.groovy} | 19 ++---
src/test/groovy/bugs/Groovy10199.groovy | 1 +
src/test/groovy/bugs/Groovy10236.groovy | 2 -
src/test/groovy/bugs/Groovy10281.groovy | 3 +-
src/test/groovy/bugs/Groovy10303.groovy | 1 +
src/test/groovy/bugs/Groovy10381.groovy | 1 +
src/test/groovy/bugs/Groovy10461.groovy | 1 +
.../{Groovy1059_Bug.groovy => Groovy1059.groovy} | 24 +++---
src/test/groovy/bugs/Groovy10659.groovy | 1 +
src/test/groovy/bugs/Groovy10676.groovy | 1 +
src/test/groovy/bugs/Groovy10700.groovy | 1 +
.../{Groovy1081_Bug.groovy => Groovy1081.groovy} | 5 +-
src/test/groovy/bugs/Groovy11062.groovy | 2 -
src/test/groovy/bugs/Groovy11182.groovy | 1 +
src/test/groovy/bugs/Groovy11265.groovy | 1 +
src/test/groovy/bugs/Groovy11272.groovy | 1 +
src/test/groovy/bugs/Groovy11293.groovy | 1 +
src/test/groovy/bugs/Groovy11568.groovy | 1 +
src/test/groovy/bugs/Groovy11613.groovy | 1 +
.../{Groovy1407_Bug.groovy => Groovy1407.groovy} | 2 +-
.../{Groovy1462_Bug.groovy => Groovy1462.groovy} | 25 +++---
src/test/groovy/bugs/Groovy1567.java | 4 +-
src/test/groovy/bugs/Groovy1593.groovy | 22 +++---
.../{Bytecode4Bug.groovy => Groovy1617.groovy} | 36 +++------
src/test/groovy/bugs/Groovy1617_Bug.groovy | 41 ----------
...{BlockAsClosureBug.groovy => Groovy1706.groovy} | 53 ++++---------
src/test/groovy/bugs/Groovy1706_Bug.groovy | 46 -----------
.../gls/syntax/UnderscoreInNumbersTest.groovy | 74 ++++++++++--------
.../asm/sc/Groovy7222OptimizationsTest.groovy | 33 ++++----
.../sc/StaticCompileCastOptimizationTest.groovy | 90 +++++++++-------------
.../groovy/gls/CompilableTestSupport.groovy | 38 ++++-----
.../stc/StaticTypeCheckingTestCase.groovy | 26 +++----
.../org/codehaus/groovy/classgen/TestSupport.java | 16 ++--
72 files changed, 296 insertions(+), 501 deletions(-)
diff --git a/src/test/groovy/NoPackageTest.groovy
b/src/test/groovy/NoPackageTest.groovy
index 78d02277fb..c44ce5c523 100644
--- a/src/test/groovy/NoPackageTest.groovy
+++ b/src/test/groovy/NoPackageTest.groovy
@@ -16,9 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
+
import org.junit.jupiter.api.Test
final class NoPackageTest {
+
@Test
void testClassDef() {
assert getClass().name == "NoPackageTest"
diff --git a/src/test/groovy/bugs/AmbiguousListOrMethodTest.groovy
b/src/test/groovy/bugs/AmbiguousListOrMethodTest.groovy
index c1c1494669..7dacba8bdf 100644
--- a/src/test/groovy/bugs/AmbiguousListOrMethodTest.groovy
+++ b/src/test/groovy/bugs/AmbiguousListOrMethodTest.groovy
@@ -22,8 +22,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.shouldFail
-
-class AmbiguousListOrMethodTest {
+final class AmbiguousListOrMethodTest {
@Test
void testLocalVariableVersion() {
@@ -62,9 +61,8 @@ class AmbiguousListOrMethodTest {
assert e[""] == 1
}
-}
-
-class Example {
- def getAt(String a, String b) {return 2}
- def getAt(String a) {return 1}
+ static class Example {
+ def getAt(String a, String b) {return 2}
+ def getAt(String a) {return 1}
+ }
}
diff --git a/src/test/groovy/bugs/AsBoolBug.groovy
b/src/test/groovy/bugs/AsBoolBug.groovy
index 4be2b5112a..24ad222a04 100644
--- a/src/test/groovy/bugs/AsBoolBug.groovy
+++ b/src/test/groovy/bugs/AsBoolBug.groovy
@@ -25,8 +25,7 @@ import org.junit.jupiter.api.Test
* Test to fix the Jira issues GROOVY-810 and GROOVY-811.
* Test of "string as Boolean" against the issue GROOVY-812.
*/
-
-public class AsBoolBug {
+final class AsBoolBug {
@Test
void testMapAsBool() {
diff --git a/src/test/groovy/bugs/AssignmentInsideExpressionBug.groovy
b/src/test/groovy/bugs/AssignmentInsideExpressionBug.groovy
index 2b46946fd6..2c50153fa9 100644
--- a/src/test/groovy/bugs/AssignmentInsideExpressionBug.groovy
+++ b/src/test/groovy/bugs/AssignmentInsideExpressionBug.groovy
@@ -22,10 +22,7 @@ import org.junit.jupiter.api.Test
import static org.junit.jupiter.api.Assertions.fail
-
-/**
- */
-class AssignmentInsideExpressionBug {
+final class AssignmentInsideExpressionBug {
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/AttributeSetExpressionBug.groovy
b/src/test/groovy/bugs/AttributeSetExpressionBug.groovy
index 48a552963f..eeb088f485 100644
--- a/src/test/groovy/bugs/AttributeSetExpressionBug.groovy
+++ b/src/test/groovy/bugs/AttributeSetExpressionBug.groovy
@@ -20,8 +20,8 @@ package bugs
import org.junit.jupiter.api.Test
+final class AttributeSetExpressionBug {
-class AttributeSetExpressionBug {
@Test
void testAttributeSetAccess() {
def a = new HasStaticFieldSomeClass()
@@ -30,16 +30,16 @@ class AttributeSetExpressionBug {
assert a.name == "gettter"
new HasStaticFieldSomeClass().@name = "changed bar"
- assert( HasStaticFieldSomeClass.class.@name == "changed bar" )
+ assert HasStaticFieldSomeClass.class.@name == "changed bar"
HasStaticFieldSomeClass.class.@name = "changed static bar"
- assert( HasStaticFieldSomeClass.class.@name == "changed static bar" )
+ assert HasStaticFieldSomeClass.class.@name == "changed static bar"
}
-}
-class HasStaticFieldSomeClass {
- static String name = "bar"
- static String getName() {
- return "gettter"
+ static class HasStaticFieldSomeClass {
+ static String name = "bar"
+ static String getName() {
+ return "gettter"
+ }
}
}
diff --git a/src/test/groovy/bugs/AutoboxingOfComparisonsBug.groovy
b/src/test/groovy/bugs/AutoboxingOfComparisonsBug.groovy
index e230511928..fadf62ccff 100644
--- a/src/test/groovy/bugs/AutoboxingOfComparisonsBug.groovy
+++ b/src/test/groovy/bugs/AutoboxingOfComparisonsBug.groovy
@@ -20,8 +20,8 @@ package bugs
import org.junit.jupiter.api.Test
+final class AutoboxingOfComparisonsBug {
-class AutoboxingOfComparisonsBug {
@Test
void testBug() {
def y = true
diff --git a/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy
b/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy
index a675f684c5..cb98575cae 100644
--- a/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy
+++ b/src/test/groovy/bugs/BadLineNumberOnExceptionBugTest.groovy
@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
-
/**
* Ensure that the correct line information is reported when an exception is
thrown.
* <p>
@@ -30,7 +29,7 @@ import static groovy.test.GroovyAssert.assertScript
* <li><a
href="https://issues.apache.org/jira/browse/GROOVY-3067">GROOVY-3067</a></li>
* <li><a
href="https://issues.apache.org/jira/browse/GROOVY-2983">GROOVY-2983</a></li>
*/
-class BadLineNumberOnExceptionBugTest {
+final class BadLineNumberOnExceptionBugTest {
@Test
void testGroovy3067() {
diff --git a/src/test/groovy/bugs/BadScriptNameBug.groovy
b/src/test/groovy/bugs/BadScriptNameBug.groovy
index ec30982b3c..d5b031a9e3 100644
--- a/src/test/groovy/bugs/BadScriptNameBug.groovy
+++ b/src/test/groovy/bugs/BadScriptNameBug.groovy
@@ -20,8 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-class BadScriptNameBug {
+final class BadScriptNameBug {
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/BenchmarkBug.groovy
b/src/test/groovy/bugs/BenchmarkBug.groovy
index 75434bde14..745f8b702b 100644
--- a/src/test/groovy/bugs/BenchmarkBug.groovy
+++ b/src/test/groovy/bugs/BenchmarkBug.groovy
@@ -20,11 +20,10 @@ package bugs
import org.junit.jupiter.api.Test
-
/**
- * A little performance test
+ * A little performance test.
*/
-class BenchmarkBug {
+final class BenchmarkBug {
@Test
void testPerformance() {
diff --git a/src/test/groovy/bugs/BlockAsClosureBug.groovy
b/src/test/groovy/bugs/BlockAsClosureBug.groovy
index 5e115d8135..92151632df 100644
--- a/src/test/groovy/bugs/BlockAsClosureBug.groovy
+++ b/src/test/groovy/bugs/BlockAsClosureBug.groovy
@@ -20,8 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-class BlockAsClosureBug {
+final class BlockAsClosureBug {
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/BooleanBug.groovy
b/src/test/groovy/bugs/BooleanBug.groovy
index 65bcef13e1..5138e0b54e 100644
--- a/src/test/groovy/bugs/BooleanBug.groovy
+++ b/src/test/groovy/bugs/BooleanBug.groovy
@@ -22,10 +22,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
-
-/**
- */
-class BooleanBug {
+final class BooleanBug {
@Test
void testBug() {
@@ -57,9 +54,8 @@ class BooleanBug {
"""
}
-}
-
-class BooleanBean {
- String name
- boolean foo
+ static class BooleanBean {
+ String name
+ boolean foo
+ }
}
diff --git a/src/test/groovy/bugs/ByteIndexBug.groovy
b/src/test/groovy/bugs/ByteIndexBug.groovy
index 1e7ac1861e..27c886fbcb 100644
--- a/src/test/groovy/bugs/ByteIndexBug.groovy
+++ b/src/test/groovy/bugs/ByteIndexBug.groovy
@@ -20,8 +20,8 @@ package bugs
import org.junit.jupiter.api.Test
+final class ByteIndexBug {
-class ByteIndexBug {
// TODO: this tests a string with 128 nulls - is that what is intended?
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/Bytecode2Bug.groovy
b/src/test/groovy/bugs/Bytecode2Bug.groovy
index 478eec1299..d22ba95f0e 100644
--- a/src/test/groovy/bugs/Bytecode2Bug.groovy
+++ b/src/test/groovy/bugs/Bytecode2Bug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class Bytecode2Bug {
+final class Bytecode2Bug {
Integer count = 0
diff --git a/src/test/groovy/bugs/Bytecode3Bug.groovy
b/src/test/groovy/bugs/Bytecode3Bug.groovy
index 3454a9b9fa..c53f6b2761 100644
--- a/src/test/groovy/bugs/Bytecode3Bug.groovy
+++ b/src/test/groovy/bugs/Bytecode3Bug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class Bytecode3Bug {
+final class Bytecode3Bug {
def count
diff --git a/src/test/groovy/bugs/Bytecode4Bug.groovy
b/src/test/groovy/bugs/Bytecode4Bug.groovy
index ddc6b7b218..67cf357d56 100644
--- a/src/test/groovy/bugs/Bytecode4Bug.groovy
+++ b/src/test/groovy/bugs/Bytecode4Bug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class Bytecode4Bug {
+final class Bytecode4Bug {
def count = 0
diff --git a/src/test/groovy/bugs/Bytecode5Bug.groovy
b/src/test/groovy/bugs/Bytecode5Bug.groovy
index 6621fbaea7..6164bd9d25 100644
--- a/src/test/groovy/bugs/Bytecode5Bug.groovy
+++ b/src/test/groovy/bugs/Bytecode5Bug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class Bytecode5Bug {
+final class Bytecode5Bug {
@Test
void testUsingLocalVar() {
diff --git a/src/test/groovy/bugs/Bytecode6Bug.groovy
b/src/test/groovy/bugs/Bytecode6Bug.groovy
index fcae72d102..694bad9d10 100644
--- a/src/test/groovy/bugs/Bytecode6Bug.groovy
+++ b/src/test/groovy/bugs/Bytecode6Bug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class Bytecode6Bug {
+final class Bytecode6Bug {
@Test
void testPostFixReturn() {
diff --git a/src/test/groovy/bugs/Bytecode7Bug.groovy
b/src/test/groovy/bugs/Bytecode7Bug.groovy
index a23aa7bcb8..3d96a9fd35 100644
--- a/src/test/groovy/bugs/Bytecode7Bug.groovy
+++ b/src/test/groovy/bugs/Bytecode7Bug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class Bytecode7Bug {
+final class Bytecode7Bug {
@Test
void testDuplicateVariables() {
diff --git a/src/test/groovy/bugs/BytecodeBug.groovy
b/src/test/groovy/bugs/BytecodeBug.groovy
index ff49da36db..b3ed346a59 100644
--- a/src/test/groovy/bugs/BytecodeBug.groovy
+++ b/src/test/groovy/bugs/BytecodeBug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class BytecodeBug {
+final class BytecodeBug {
@Test
void testTedsBytecodeBug() {
diff --git a/src/test/groovy/bugs/CallingClosuresWithClosuresBug.groovy
b/src/test/groovy/bugs/CallingClosuresWithClosuresBug.groovy
index 0e756430a7..32d3de82dd 100644
--- a/src/test/groovy/bugs/CallingClosuresWithClosuresBug.groovy
+++ b/src/test/groovy/bugs/CallingClosuresWithClosuresBug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class CallingClosuresWithClosuresBug {
+final class CallingClosuresWithClosuresBug {
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/CastWhenUsingClosuresBug.groovy
b/src/test/groovy/bugs/CastWhenUsingClosuresBug.groovy
index 1005abf383..9fc4a03972 100644
--- a/src/test/groovy/bugs/CastWhenUsingClosuresBug.groovy
+++ b/src/test/groovy/bugs/CastWhenUsingClosuresBug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class CastWhenUsingClosuresBug {
+final class CastWhenUsingClosuresBug {
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/ChristofsPropertyBug.groovy
b/src/test/groovy/bugs/ChristofsPropertyBug.groovy
index a32fd590d1..e85bcb1bfd 100644
--- a/src/test/groovy/bugs/ChristofsPropertyBug.groovy
+++ b/src/test/groovy/bugs/ChristofsPropertyBug.groovy
@@ -22,8 +22,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.shouldFail
-
-class ChristofsPropertyBug {
+final class ChristofsPropertyBug {
def mixedCaseProperty
diff --git a/src/test/groovy/bugs/ClassGeneratorFixesTest.groovy
b/src/test/groovy/bugs/ClassGeneratorFixesTest.groovy
index 36dea0bd5c..db4634e858 100644
--- a/src/test/groovy/bugs/ClassGeneratorFixesTest.groovy
+++ b/src/test/groovy/bugs/ClassGeneratorFixesTest.groovy
@@ -20,10 +20,9 @@ package bugs
import org.junit.jupiter.api.Test
+final class ClassGeneratorFixesTest {
-
-class ClassGeneratorFixesTest {
- def count = 0;
+ def count = 0
def pf(int p) {
int i = p
@@ -95,10 +94,8 @@ class ClassGeneratorFixesTest {
@Test
void testBooleanValue() { // groovy-385
- /** @todo
- boolean value
- */
- }
-
+ /* TODO
+ boolean value
+ */
+ }
}
-
diff --git a/src/test/groovy/bugs/ClassInNamedParamsBug.groovy
b/src/test/groovy/bugs/ClassInNamedParamsBug.groovy
index f688f33ea8..f21998ea8d 100644
--- a/src/test/groovy/bugs/ClassInNamedParamsBug.groovy
+++ b/src/test/groovy/bugs/ClassInNamedParamsBug.groovy
@@ -20,8 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-class ClassInNamedParamsBug {
+final class ClassInNamedParamsBug {
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/ClosureInClosureBug.groovy
b/src/test/groovy/bugs/ClosureInClosureBug.groovy
index 3763cc5bd3..7474ea4a58 100644
--- a/src/test/groovy/bugs/ClosureInClosureBug.groovy
+++ b/src/test/groovy/bugs/ClosureInClosureBug.groovy
@@ -20,7 +20,6 @@ package bugs
import org.junit.jupiter.api.Test
-
/**
* Bug illustrating the nested closures variable scope visibility issue.
* l.each is ClosureInClosureBug$1 and it.each is ClosureInClosureBug$2
@@ -32,7 +31,7 @@ import org.junit.jupiter.api.Test
*
* @authour Guillaume Laforge
*/
-class ClosureInClosureBug {
+final class ClosureInClosureBug {
@Test
void testInvisibleVariable() {
diff --git a/src/test/groovy/bugs/ClosureTypedVariableBug.groovy
b/src/test/groovy/bugs/ClosureTypedVariableBug.groovy
index 58e4861cc3..9234204d1d 100644
--- a/src/test/groovy/bugs/ClosureTypedVariableBug.groovy
+++ b/src/test/groovy/bugs/ClosureTypedVariableBug.groovy
@@ -20,8 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-class ClosureTypedVariableBug {
+final class ClosureTypedVariableBug {
@Test
void testBug2() {
diff --git a/src/test/groovy/bugs/ClosureVariableBug.groovy
b/src/test/groovy/bugs/ClosureVariableBug.groovy
index 20110ad146..bc52b56384 100644
--- a/src/test/groovy/bugs/ClosureVariableBug.groovy
+++ b/src/test/groovy/bugs/ClosureVariableBug.groovy
@@ -22,10 +22,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
-
-/**
- */
-class ClosureVariableBug {
+final class ClosureVariableBug {
@Test
void testClosurePassingBug() {
diff --git a/src/test/groovy/bugs/ClosureWithBitwiseDefaultParamTest.groovy
b/src/test/groovy/bugs/ClosureWithBitwiseDefaultParamTest.groovy
index e19628e5af..18aa633fbd 100644
--- a/src/test/groovy/bugs/ClosureWithBitwiseDefaultParamTest.groovy
+++ b/src/test/groovy/bugs/ClosureWithBitwiseDefaultParamTest.groovy
@@ -20,8 +20,8 @@ package bugs
import org.junit.jupiter.api.Test
+final class ClosureWithBitwiseDefaultParamTest {
-class ClosureWithBitwiseDefaultParamTest {
@Test
void testAmbiguousStuff() {
def c = { x, y = 1 | 2, z = 0->
diff --git a/src/test/groovy/bugs/ClosureWithStaticVariablesBug.groovy
b/src/test/groovy/bugs/ClosureWithStaticVariablesBug.groovy
index f6901c0d45..a4aa8235d3 100644
--- a/src/test/groovy/bugs/ClosureWithStaticVariablesBug.groovy
+++ b/src/test/groovy/bugs/ClosureWithStaticVariablesBug.groovy
@@ -42,8 +42,8 @@ final class ClosureWithStaticVariablesBug {
def answer = c2()
assert answer == 6
}
-}
-class Cheese {
- public static z = [:]
+ static class Cheese {
+ public static z = [:]
+ }
}
diff --git a/src/test/groovy/bugs/ConstructorBug.groovy
b/src/test/groovy/bugs/ConstructorBug.groovy
index c4e041d853..8d88ba5327 100644
--- a/src/test/groovy/bugs/ConstructorBug.groovy
+++ b/src/test/groovy/bugs/ConstructorBug.groovy
@@ -21,7 +21,7 @@ package bugs
import org.codehaus.groovy.runtime.InvokerHelper
import org.junit.jupiter.api.Test
-class ConstructorBug {
+final class ConstructorBug {
@Test
void testBug() {
@@ -41,8 +41,8 @@ class ConstructorBug {
assert test.foo == null
*/
-//foo = new type('hello')
/*
+ foo = new type('hello')
*/
mytest = new TestDerived("Hello")
assert mytest.foo == "Hello"
diff --git a/src/test/groovy/bugs/ConstructorThisCallBug.groovy
b/src/test/groovy/bugs/ConstructorThisCallBug.groovy
index 2d07b9ce0b..1b83269d07 100644
--- a/src/test/groovy/bugs/ConstructorThisCallBug.groovy
+++ b/src/test/groovy/bugs/ConstructorThisCallBug.groovy
@@ -77,9 +77,8 @@ final class ConstructorThisCallBug {
'''
}
- //
-
- @Test // GROOVY-7014
+ // GROOVY-7014
+ @Test
void testThisCallingInstanceMethod() {
def err = shouldFail '''
class Base {
@@ -131,7 +130,8 @@ final class ConstructorThisCallBug {
//
- @Test // GROOVY-994
+ // GROOVY-994
+ @Test
void testCallA() {
assert new ConstructorCallA("foo").toString() == 'foo'
assert new ConstructorCallA(9).toString() == '81'
diff --git a/src/test/groovy/bugs/CustomMetaClassTest.groovy
b/src/test/groovy/bugs/CustomMetaClassTest.groovy
index 6153eda1ce..7ab81e5bb9 100644
--- a/src/test/groovy/bugs/CustomMetaClassTest.groovy
+++ b/src/test/groovy/bugs/CustomMetaClassTest.groovy
@@ -21,11 +21,10 @@ package bugs
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
-class CustomMetaClassTest {
+final class CustomMetaClassTest {
@BeforeEach
void setUp() {
-
ExpandoMetaClass.disableGlobally()
def reg = GroovySystem.metaClassRegistry
@@ -134,16 +133,14 @@ class CustomMetaClassTest {
assert groovy.runtime.metaclass.bugs.CustomMetaClassTestMetaClass ==
getMetaClass().delegate.class
}
-}
-
-class MyDelegatingMetaClass extends groovy.lang.DelegatingMetaClass {
- MyDelegatingMetaClass(final Class a_class) {
- super(a_class);
- initialize()
- }
+ static class MyDelegatingMetaClass extends groovy.lang.DelegatingMetaClass
{
+ MyDelegatingMetaClass(final Class a_class) {
+ super(a_class);
+ initialize()
+ }
- public Object invokeMethod(Object a_object, String a_methodName, Object[]
a_arguments) {
- return "changed ${super.invokeMethod(a_object, a_methodName,
a_arguments)}"
+ public Object invokeMethod(Object a_object, String a_methodName,
Object[] a_arguments) {
+ return "changed ${super.invokeMethod(a_object, a_methodName,
a_arguments)}"
+ }
}
}
-
diff --git a/src/test/groovy/bugs/DefVariableBug.groovy
b/src/test/groovy/bugs/DefVariableBug.groovy
index fe330e33c5..2bc821a395 100644
--- a/src/test/groovy/bugs/DefVariableBug.groovy
+++ b/src/test/groovy/bugs/DefVariableBug.groovy
@@ -20,8 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-class DefVariableBug {
+final class DefVariableBug {
@Test
void testBug() {
diff --git a/src/test/groovy/bugs/ForLoopBug.groovy
b/src/test/groovy/bugs/ForLoopBug.groovy
index 1daa4b48f0..8b22989591 100644
--- a/src/test/groovy/bugs/ForLoopBug.groovy
+++ b/src/test/groovy/bugs/ForLoopBug.groovy
@@ -22,8 +22,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
-
-class ForLoopBug {
+final class ForLoopBug {
@Test
void testBug() {
@@ -82,5 +81,4 @@ class ForLoopBug {
}
"""
}
-
}
diff --git a/src/test/groovy/bugs/FullyQualifiedClassBug.groovy
b/src/test/groovy/bugs/FullyQualifiedClassBug.groovy
index 98e7598dad..6ded85149a 100644
--- a/src/test/groovy/bugs/FullyQualifiedClassBug.groovy
+++ b/src/test/groovy/bugs/FullyQualifiedClassBug.groovy
@@ -20,14 +20,10 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class FullyQualifiedClassBug {
+final class FullyQualifiedClassBug {
@Test
void testBug() {
java.lang.System.err.println("Hello world")
}
-
}
diff --git a/src/test/groovy/bugs/FullyQualifiedMethodReturnTypeBug.groovy
b/src/test/groovy/bugs/FullyQualifiedMethodReturnTypeBug.groovy
index 4efd9f668b..a50a8de988 100644
--- a/src/test/groovy/bugs/FullyQualifiedMethodReturnTypeBug.groovy
+++ b/src/test/groovy/bugs/FullyQualifiedMethodReturnTypeBug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class FullyQualifiedMethodReturnTypeBug {
+final class FullyQualifiedMethodReturnTypeBug {
@Test
void testBug() {
@@ -34,5 +31,4 @@ class FullyQualifiedMethodReturnTypeBug {
java.lang.String foo() {
return "hey"
}
-
}
diff --git a/src/test/groovy/bugs/FullyQualifiedVariableTypeBug.groovy
b/src/test/groovy/bugs/FullyQualifiedVariableTypeBug.groovy
index c384366fca..e32dfdec1b 100644
--- a/src/test/groovy/bugs/FullyQualifiedVariableTypeBug.groovy
+++ b/src/test/groovy/bugs/FullyQualifiedVariableTypeBug.groovy
@@ -20,15 +20,11 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class FullyQualifiedVariableTypeBug {
+final class FullyQualifiedVariableTypeBug {
@Test
void testBug() {
java.lang.String s = "hey"
assert s.length() == 3
}
-
}
diff --git a/src/test/groovy/bugs/GetterBug.groovy
b/src/test/groovy/bugs/GetterBug.groovy
index d2905a8360..5657f4acda 100644
--- a/src/test/groovy/bugs/GetterBug.groovy
+++ b/src/test/groovy/bugs/GetterBug.groovy
@@ -20,10 +20,7 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class GetterBug {
+final class GetterBug {
String foo
def bar
@@ -37,7 +34,7 @@ class GetterBug {
void setFoo(String foo) {
this.foo = foo
- }
+ }
@Test
void testTypedGetterAndSetter() {
@@ -63,7 +60,6 @@ class GetterBug {
this.bar = bar
}
-
@Test
void testUntypedGetterAndSetter() {
def value = getBar()
@@ -76,5 +72,4 @@ class GetterBug {
assert value == "Bob"
}
-
}
diff --git a/src/test/groovy/bugs/Groovy10143.groovy
b/src/test/groovy/bugs/Groovy10143.groovy
index 164674e04e..67d410357a 100644
--- a/src/test/groovy/bugs/Groovy10143.groovy
+++ b/src/test/groovy/bugs/Groovy10143.groovy
@@ -25,6 +25,7 @@ import
org.codehaus.groovy.control.customizers.ASTTransformationCustomizer
import org.junit.jupiter.api.Test
final class Groovy10143 {
+
@Test
void testTraitsAndTypes() {
def config = new CompilerConfiguration(targetDirectory:
File.createTempDir())
diff --git a/src/test/groovy/bugs/Groovy1018_Bug.groovy
b/src/test/groovy/bugs/Groovy1018.groovy
similarity index 75%
rename from src/test/groovy/bugs/Groovy1018_Bug.groovy
rename to src/test/groovy/bugs/Groovy1018.groovy
index 9f2d4e6a8e..ca6ab2e74d 100644
--- a/src/test/groovy/bugs/Groovy1018_Bug.groovy
+++ b/src/test/groovy/bugs/Groovy1018.groovy
@@ -20,31 +20,28 @@ package bugs
import org.junit.jupiter.api.Test
-
/**
* Test to fix the Jira issues GROOVY-1018 and GROOVY-732.
* Access to a static field member by a class name:
* ClassName.fieldName or ClassName.@fieldName.
*/
+final class Groovy1018 {
-class Groovy1018_Bug {
-
- public static Object Class = "bar"
+ public static Object Class = 'bar'
// GROOVY-1018
@Test
void testGetPublicStaticField() {
- Groovy1018_Bug.Class = 'bar'
- def a = new Groovy1018_Bug()
- assert a.Class == "bar" && a.@Class == "bar"
- assert Groovy1018_Bug.Class == "bar" && Groovy1018_Bug.@Class == "bar"
+ Groovy1018.Class = 'bar'
+ def a = new Groovy1018()
+ assert a.Class == 'bar' && a.@Class == 'bar'
+ assert Groovy1018.Class == 'bar' && Groovy1018.@Class == 'bar'
}
// GROOVY-732
@Test
void testSetPublicStaticField() {
- Groovy1018_Bug.Class = 'bar-'
- assert Groovy1018_Bug.Class == "bar-" && Groovy1018_Bug.@Class ==
"bar-"
+ Groovy1018.Class = 'bar-'
+ assert Groovy1018.Class == 'bar-' && Groovy1018.@Class == 'bar-'
}
-
}
diff --git a/src/test/groovy/bugs/Groovy10199.groovy
b/src/test/groovy/bugs/Groovy10199.groovy
index aa393a8e8b..d8680ab836 100644
--- a/src/test/groovy/bugs/Groovy10199.groovy
+++ b/src/test/groovy/bugs/Groovy10199.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy10199 {
+
@Test
void testTransformClasspath() {
def shell = new GroovyShell()
diff --git a/src/test/groovy/bugs/Groovy10236.groovy
b/src/test/groovy/bugs/Groovy10236.groovy
index 2dea972253..d8eb48d64b 100644
--- a/src/test/groovy/bugs/Groovy10236.groovy
+++ b/src/test/groovy/bugs/Groovy10236.groovy
@@ -18,12 +18,10 @@
*/
package bugs
-import groovy.transform.CompileStatic
import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
-@CompileStatic
final class Groovy10236 {
@Test
diff --git a/src/test/groovy/bugs/Groovy10281.groovy
b/src/test/groovy/bugs/Groovy10281.groovy
index e99f4a8ae2..8b0c17bfff 100644
--- a/src/test/groovy/bugs/Groovy10281.groovy
+++ b/src/test/groovy/bugs/Groovy10281.groovy
@@ -18,14 +18,13 @@
*/
package bugs
-import groovy.transform.CompileStatic
import org.codehaus.groovy.control.CompilationUnit
import org.codehaus.groovy.control.CompilerConfiguration
import org.codehaus.groovy.control.Phases
import org.junit.jupiter.api.Test
-@CompileStatic
final class Groovy10281 {
+
@Test
void testLoggingClassGenWithStacktrace() {
def result = logClassGen(true)
diff --git a/src/test/groovy/bugs/Groovy10303.groovy
b/src/test/groovy/bugs/Groovy10303.groovy
index f9618df212..a8d5fa1bfe 100644
--- a/src/test/groovy/bugs/Groovy10303.groovy
+++ b/src/test/groovy/bugs/Groovy10303.groovy
@@ -22,6 +22,7 @@ import org.codehaus.groovy.control.CompilerConfiguration
import org.junit.jupiter.api.Test
final class Groovy10303 {
+
@Test
void testCompileStackClearNPE() {
CompilerConfiguration config = new CompilerConfiguration()
diff --git a/src/test/groovy/bugs/Groovy10381.groovy
b/src/test/groovy/bugs/Groovy10381.groovy
index 12dcc6b2b3..2190d74014 100644
--- a/src/test/groovy/bugs/Groovy10381.groovy
+++ b/src/test/groovy/bugs/Groovy10381.groovy
@@ -26,6 +26,7 @@ import static groovy.test.GroovyAssert.assertScript
import static groovy.test.GroovyAssert.shouldFail
final class Groovy10381 {
+
@Test
void testDuplicateDefaultMethodsFromGroovyClasses_implements0() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy10461.groovy
b/src/test/groovy/bugs/Groovy10461.groovy
index 8079eafa72..cb510dde61 100644
--- a/src/test/groovy/bugs/Groovy10461.groovy
+++ b/src/test/groovy/bugs/Groovy10461.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy10461 {
+
@Test
void testParseClassWithOptionalDependencies() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy1059_Bug.groovy
b/src/test/groovy/bugs/Groovy1059.groovy
similarity index 78%
rename from src/test/groovy/bugs/Groovy1059_Bug.groovy
rename to src/test/groovy/bugs/Groovy1059.groovy
index 31e71428b8..b880b5043a 100644
--- a/src/test/groovy/bugs/Groovy1059_Bug.groovy
+++ b/src/test/groovy/bugs/Groovy1059.groovy
@@ -20,7 +20,6 @@ package bugs
import org.junit.jupiter.api.Test
-
/**
* GROOVY-1059
*
@@ -34,17 +33,16 @@ import org.junit.jupiter.api.Test
*
* have the same meaning.
*/
-
-class Groovy1059_Bug {
+final class Groovy1059 {
@Test
void testClosureAsAttribute() {
def x = new Groovy1059Foo()
- assert "I am a Method" == x.say()
- assert "I am a Method" == x.@say2()
- assert "I am a Closure" == (x.@say)()
- assert "I am a Closure" == x.@say()
+ assert 'I am a Method' == x.say()
+ assert 'I am a Method' == x.@say2()
+ assert 'I am a Closure' == (x.@say)()
+ assert 'I am a Closure' == x.@say()
assert x.@say() == (x.@say)()
assert x.@say() == [email protected]()
assert x.@say() == [email protected]()
@@ -52,14 +50,14 @@ class Groovy1059_Bug {
assert x.@say2() == x.say()
}
-}
+ static class Groovy1059Foo {
-class Groovy1059Foo {
+ public say = { it -> return 'I am a Closure' }
- def public say = { it -> return "I am a Closure" }
- def public say2 = this.&say
+ public say2 = this.&say
- public Object say() {
- return "I am a Method"
+ public Object say() {
+ return 'I am a Method'
+ }
}
}
diff --git a/src/test/groovy/bugs/Groovy10659.groovy
b/src/test/groovy/bugs/Groovy10659.groovy
index 7f7e70a0b6..b3a5642161 100644
--- a/src/test/groovy/bugs/Groovy10659.groovy
+++ b/src/test/groovy/bugs/Groovy10659.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy10659 {
+
@Test
void test() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy10676.groovy
b/src/test/groovy/bugs/Groovy10676.groovy
index cb5f94b3e2..d35743c889 100644
--- a/src/test/groovy/bugs/Groovy10676.groovy
+++ b/src/test/groovy/bugs/Groovy10676.groovy
@@ -22,6 +22,7 @@ import org.codehaus.groovy.tools.ErrorReporter
import org.junit.jupiter.api.Test
final class Groovy10676 {
+
@Test
void test() {
try {
diff --git a/src/test/groovy/bugs/Groovy10700.groovy
b/src/test/groovy/bugs/Groovy10700.groovy
index e5ec1965a6..4bb7fe7b61 100644
--- a/src/test/groovy/bugs/Groovy10700.groovy
+++ b/src/test/groovy/bugs/Groovy10700.groovy
@@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy10700 {
+
@Test
void testDelegateAndInterface() {
def config = new CompilerConfiguration(targetDirectory:
File.createTempDir())
diff --git a/src/test/groovy/bugs/Groovy1081_Bug.groovy
b/src/test/groovy/bugs/Groovy1081.groovy
similarity index 98%
rename from src/test/groovy/bugs/Groovy1081_Bug.groovy
rename to src/test/groovy/bugs/Groovy1081.groovy
index 7fd3ce3a4d..b11ddf2abe 100644
--- a/src/test/groovy/bugs/Groovy1081_Bug.groovy
+++ b/src/test/groovy/bugs/Groovy1081.groovy
@@ -22,13 +22,11 @@ import org.junit.jupiter.api.Test
import static org.junit.jupiter.api.Assertions.assertTrue
-
/**
* Verifies that DefaultGroovyMethods.transformLine(Reader, Writer, Closure)
* actually writes its output.
*/
-
-class Groovy1081_Bug {
+final class Groovy1081 {
@Test
void testShort() {
@@ -40,5 +38,4 @@ class Groovy1081_Bug {
// Implementation was creating a BufferedWriter, but not flushing it
assertTrue(writer.toString().startsWith('abc'))
}
-
}
diff --git a/src/test/groovy/bugs/Groovy11062.groovy
b/src/test/groovy/bugs/Groovy11062.groovy
index e5949fede5..bcf568eada 100644
--- a/src/test/groovy/bugs/Groovy11062.groovy
+++ b/src/test/groovy/bugs/Groovy11062.groovy
@@ -19,14 +19,12 @@
package bugs
import groovy.transform.AnnotationCollector
-import groovy.transform.CompileStatic
import groovy.transform.NullCheck
import groovy.transform.RecordType
import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
-@CompileStatic
final class Groovy11062 {
@Test
diff --git a/src/test/groovy/bugs/Groovy11182.groovy
b/src/test/groovy/bugs/Groovy11182.groovy
index 6205a32124..c3a47b83a1 100644
--- a/src/test/groovy/bugs/Groovy11182.groovy
+++ b/src/test/groovy/bugs/Groovy11182.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy11182 {
+
@Test
void testVariadicPrimitiveArray() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy11265.groovy
b/src/test/groovy/bugs/Groovy11265.groovy
index defe4fc2bc..51250f7f42 100644
--- a/src/test/groovy/bugs/Groovy11265.groovy
+++ b/src/test/groovy/bugs/Groovy11265.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy11265 {
+
@Test
void testDefaultMethodWithLambdaReturn() {
assertScript '''import java.util.function.Function
diff --git a/src/test/groovy/bugs/Groovy11272.groovy
b/src/test/groovy/bugs/Groovy11272.groovy
index 77404555b6..fffc6d8ca6 100644
--- a/src/test/groovy/bugs/Groovy11272.groovy
+++ b/src/test/groovy/bugs/Groovy11272.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy11272 {
+
@Test
void testSerialVersionUID_1() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy11293.groovy
b/src/test/groovy/bugs/Groovy11293.groovy
index 7760b7839b..af3eb55fc5 100644
--- a/src/test/groovy/bugs/Groovy11293.groovy
+++ b/src/test/groovy/bugs/Groovy11293.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy11293 {
+
@Test
void testVarargs() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy11568.groovy
b/src/test/groovy/bugs/Groovy11568.groovy
index b99a64b4c1..3e70804e3c 100644
--- a/src/test/groovy/bugs/Groovy11568.groovy
+++ b/src/test/groovy/bugs/Groovy11568.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy11568 {
+
@Test
void testPrivateMethodWithCustomMetaClass() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy11613.groovy
b/src/test/groovy/bugs/Groovy11613.groovy
index 47664c0b5c..6c4be3c0f6 100644
--- a/src/test/groovy/bugs/Groovy11613.groovy
+++ b/src/test/groovy/bugs/Groovy11613.groovy
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test
import static groovy.test.GroovyAssert.assertScript
final class Groovy11613 {
+
@Test
void testInterfaceDefaultMethods() {
assertScript '''
diff --git a/src/test/groovy/bugs/Groovy1407_Bug.groovy
b/src/test/groovy/bugs/Groovy1407.groovy
similarity index 98%
rename from src/test/groovy/bugs/Groovy1407_Bug.groovy
rename to src/test/groovy/bugs/Groovy1407.groovy
index 84182564a7..d64bceb851 100644
--- a/src/test/groovy/bugs/Groovy1407_Bug.groovy
+++ b/src/test/groovy/bugs/Groovy1407.groovy
@@ -20,8 +20,8 @@ package bugs
import org.junit.jupiter.api.Test
+final class Groovy1407 {
-class Groovy1407_Bug {
@Test
void testGPathOnMultiKeyMap(){
// each key is a two-element String list
diff --git a/src/test/groovy/bugs/Groovy1462_Bug.groovy
b/src/test/groovy/bugs/Groovy1462.groovy
similarity index 79%
rename from src/test/groovy/bugs/Groovy1462_Bug.groovy
rename to src/test/groovy/bugs/Groovy1462.groovy
index 4d333b5799..da3bf59087 100644
--- a/src/test/groovy/bugs/Groovy1462_Bug.groovy
+++ b/src/test/groovy/bugs/Groovy1462.groovy
@@ -20,12 +20,10 @@ package bugs
import org.junit.jupiter.api.Test
-
/**
* Verifies that the Groovy parser can accept quoted methods.
*/
-
-class Groovy1462_Bug {
+final class Groovy1462 {
@Test
void testShort() {
@@ -42,15 +40,14 @@ class Groovy1462_Bug {
assert smn.fooDef() == null
}
-}
-
-class StringMethodName {
- def foo0() {'foo0'} // control
- def 'foo1'() {'foo1'}
- public Integer 'foo2'() {2}
- public int 'foo3'() {3}
- Integer 'foo4'(x) { x * 4}
- public def 'getFoo5'() {'foo5'}
- private boolean 'fooFalse'() {false}
- public def 'fooDef'() {}
+ static class StringMethodName {
+ def foo0() {'foo0'} // control
+ def 'foo1'() {'foo1'}
+ public Integer 'foo2'() {2}
+ public int 'foo3'() {3}
+ Integer 'foo4'(x) { x * 4}
+ public def 'getFoo5'() {'foo5'}
+ private boolean 'fooFalse'() {false}
+ public def 'fooDef'() {}
+ }
}
diff --git a/src/test/groovy/bugs/Groovy1567.java
b/src/test/groovy/bugs/Groovy1567.java
index c104970caa..919a36660a 100644
--- a/src/test/groovy/bugs/Groovy1567.java
+++ b/src/test/groovy/bugs/Groovy1567.java
@@ -25,10 +25,10 @@ import org.junit.jupiter.api.Test;
import java.io.File;
-public final class Groovy1567 {
+final class Groovy1567 {
@Test
- public void testGroovyScriptEngineVsGroovyShell() throws Exception {
+ void testGroovyScriptEngineVsGroovyShell() throws Exception {
// @todo refactor this path
File currentDir = new File("src/test/groovy/bugs");
String file = "scriptForGroovy1567.groovy";
diff --git a/src/test/groovy/bugs/Groovy1593.groovy
b/src/test/groovy/bugs/Groovy1593.groovy
index 99ef8c4373..e7485090ce 100644
--- a/src/test/groovy/bugs/Groovy1593.groovy
+++ b/src/test/groovy/bugs/Groovy1593.groovy
@@ -22,17 +22,17 @@ import org.junit.jupiter.api.Test
import static org.junit.jupiter.api.Assertions.assertNull
+final class Groovy1593 {
-class Groovy1593 {
- @Test
- void testPropertyAccessInSubClassOfHashMap() {
- def subclass = new SubClassOfHashMap()
- // any of the following caused a MPE previously
- assertNull subclass.property
- subclass.property = "value"
- assert "value" == subclass.property
- }
+ @Test
+ void testPropertyAccessInSubClassOfHashMap() {
+ def subclass = new SubClassOfHashMap()
+ // any of the following caused a MPE previously
+ assertNull subclass.property
+ subclass.property = "value"
+ assert "value" == subclass.property
+ }
+ static class SubClassOfHashMap extends HashMap {
+ }
}
-
-class SubClassOfHashMap extends HashMap {}
diff --git a/src/test/groovy/bugs/Bytecode4Bug.groovy
b/src/test/groovy/bugs/Groovy1617.groovy
similarity index 65%
copy from src/test/groovy/bugs/Bytecode4Bug.groovy
copy to src/test/groovy/bugs/Groovy1617.groovy
index ddc6b7b218..71b5d99f70 100644
--- a/src/test/groovy/bugs/Bytecode4Bug.groovy
+++ b/src/test/groovy/bugs/Groovy1617.groovy
@@ -20,34 +20,22 @@ package bugs
import org.junit.jupiter.api.Test
-
-/**
- */
-class Bytecode4Bug {
-
- def count = 0
-
- @Test
- void testInject() {
- def x = [1, 2, 3].inject(0) { c, s -> c += s }
- assert x == 6
- }
+final class Groovy1617 {
@Test
- void testUsingProperty() {
- count = 0
- getCollection().each { count += it }
- assert count == 10
+ void testCoerceStringIntoStringArray() {
+ def expected = ["G","r","o","o","v","y"] as String[]
+ def actual = "Groovy" as String[]
+ assert expected == actual
}
@Test
- void testUsingIncrementingProperty() {
- count = 0
- getCollection().each { count++ }
- assert count == 4
- }
-
- def getCollection() {
- [1, 2, 3, 4]
+ void testCoerceGStringIntoStringArray() {
+ def expected = ["G","r","o","o","v","y"] as String[]
+ def a = "Gro"
+ def b = "ovy"
+ // previously returned ["Groovy"]
+ def actual = "$a$b" as String[]
+ assert expected == actual
}
}
diff --git a/src/test/groovy/bugs/Groovy1617_Bug.groovy
b/src/test/groovy/bugs/Groovy1617_Bug.groovy
deleted file mode 100644
index d2b9304596..0000000000
--- a/src/test/groovy/bugs/Groovy1617_Bug.groovy
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package bugs
-
-import org.junit.jupiter.api.Test
-
-
-class Groovy1617_Bug {
- @Test
- void testCoerceStringIntoStringArray() {
- def expected = ["G","r","o","o","v","y"] as String[]
- def actual = "Groovy" as String[]
- assert expected == actual
- }
-
- @Test
- void testCoerceGStringIntoStringArray() {
- def expected = ["G","r","o","o","v","y"] as String[]
- def a = "Gro"
- def b = "ovy"
- // previously returned ["Groovy"]
- def actual = "$a$b" as String[]
- assert expected == actual
- }
-}
diff --git a/src/test/groovy/bugs/BlockAsClosureBug.groovy
b/src/test/groovy/bugs/Groovy1706.groovy
similarity index 56%
copy from src/test/groovy/bugs/BlockAsClosureBug.groovy
copy to src/test/groovy/bugs/Groovy1706.groovy
index 5e115d8135..9c13a2c311 100644
--- a/src/test/groovy/bugs/BlockAsClosureBug.groovy
+++ b/src/test/groovy/bugs/Groovy1706.groovy
@@ -20,48 +20,27 @@ package bugs
import org.junit.jupiter.api.Test
-
-class BlockAsClosureBug {
+final class Groovy1706 {
@Test
- void testBug() {
- def c = 0
-
- block: {
- c = 9
- }
-
- assert c == 9
+ void testStaticMethodIsCalledFromSubclass() {
+ // disclaimer: static methods shouldn't be
+ // called on instances
+ Groovy1706A a = new Groovy1706A()
+ Groovy1706B b = new Groovy1706B()
+ assert "A" == a.doit()
+ assert "B" == b.doit()
}
@Test
- void testStaticBug() {
- staticMethod(null)
+ void testStaticMethodIsCalledInCorrectInstance() {
+ // disclaimer: static methods shouldn't be
+ // called on instances
+ Groovy1706A i = new Groovy1706B()
+ assert "B" == i.doit()
+ // in Java the answer would be "A"
}
- @Test
- void testNonVoidMethod() {
- foo()
- }
-
- static void staticMethod(args) {
- def c = 0
-
- block: {
- c = 9
- }
-
- assert c == 9
- }
-
- def foo() {
- def c = 0
-
- block: {
- c = 9
- }
-
- assert c == 9
- return 5
- }
+ static class Groovy1706A { static doit() { "A" } }
+ static class Groovy1706B extends Groovy1706A { static doit() { "B" } }
}
diff --git a/src/test/groovy/bugs/Groovy1706_Bug.groovy
b/src/test/groovy/bugs/Groovy1706_Bug.groovy
deleted file mode 100644
index ff3a41684c..0000000000
--- a/src/test/groovy/bugs/Groovy1706_Bug.groovy
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package bugs
-
-import org.junit.jupiter.api.Test
-
-
-class Groovy1706_Bug {
- @Test
- void testStaticMethodIsCalledFromSubclass() {
- // disclaimer: static methods shouldn't be
- // called on instances
- Groovy1706A a = new Groovy1706A()
- Groovy1706B b = new Groovy1706B()
- assert "A" == a.doit()
- assert "B" == b.doit()
- }
-
- @Test
- void testStaticMethodIsCalledInCorrectInstance() {
- // disclaimer: static methods shouldn't be
- // called on instances
- Groovy1706A i = new Groovy1706B()
- assert "B" == i.doit()
- // in Java the answer would be "A"
- }
-}
-
-class Groovy1706A { static doit() { "A" } }
-class Groovy1706B extends Groovy1706A { static doit() { "B" } }
diff --git a/src/test/groovy/gls/syntax/UnderscoreInNumbersTest.groovy
b/src/test/groovy/gls/syntax/UnderscoreInNumbersTest.groovy
index 38d440409c..431f63a8ca 100644
--- a/src/test/groovy/gls/syntax/UnderscoreInNumbersTest.groovy
+++ b/src/test/groovy/gls/syntax/UnderscoreInNumbersTest.groovy
@@ -18,14 +18,18 @@
*/
package gls.syntax
-import gls.CompilableTestSupport
import org.junit.jupiter.api.Test
+import org.junit.jupiter.params.ParameterizedTest
+import org.junit.jupiter.params.provider.ValueSource
+
+import static groovy.test.GroovyAssert.assertScript
+import static groovy.test.GroovyAssert.shouldFail
/**
* Most of the below examples were taken from the Project Coin proposal here:
* http://mail.openjdk.java.net/pipermail/coin-dev/2009-April/001628.html
*/
-final class UnderscoreInNumbersTest extends CompilableTestSupport {
+final class UnderscoreInNumbersTest {
@Test
void testUnderscore() {
@@ -38,8 +42,8 @@ final class UnderscoreInNumbersTest extends
CompilableTestSupport {
* http://mail.openjdk.java.net/pipermail/coin-dev/2009-April/001628.html
*/
@Test
- void testExamplesShouldCompileFromProposal() {
- shouldCompile '''
+ void testExamplesFromProposalShouldCompile() {
+ assertScript '''
long creditCardNumber = 1234_5678_9012_3456L
long socialSecurityNumbers = 999_99_9999L
float monetaryAmount = 12_345_132.12
@@ -60,47 +64,49 @@ final class UnderscoreInNumbersTest extends
CompilableTestSupport {
*/
@Test
void testExampleFromProposalWithBinaryLiterals() {
- shouldCompile '''
+ assertScript '''
byte nybbles = 0b0010_0101
long bytes = 0b11010010_01101001_10010100_10010010
int weirdBitfields = 0b000_10_101
'''
}
+ @Test
+ void testLeadingUnderscore() {
+ def binding = new Binding(_52: 42)
+ // This is an identifier, not a numeric literal.
+ new GroovyShell(binding).evaluate('int x1 = _52; assert x1 == 42')
+ }
+
/**
* Underscore must be placed between digits
* http://mail.openjdk.java.net/pipermail/coin-dev/2009-April/001628.html
*/
- @Test
- void testPositionOfUnderscoresAndWhatsValidOrInvalid() {
- shouldCompile '''
- int x1 = _52; // This is an identifier, not a numeric literal.
- int x2 = 5_2; // OK. (Decimal literal)
- int x3 = 5_______2; // OK. (Decimal literal.)
-
- int x6 = 0x5_2; // OK. (Hexadecimal literal)
-
- int x7 = 0_52; // OK. (Octal literal)
- int x8 = 05_2; // OK. (Octal literal)
- '''
-
- shouldNotCompile '''
- int x2 = 52_; // Illegal. (Underscores must always be between
digits)
-
- int x4 = 0_x52; // Illegal. Can't put underscores in the "0x"
radix prefix.
- int x5 = 0x_52; // Illegal. (Underscores must always be between
digits)
-
- int x6 = 0x52_; // Illegal. (Underscores must always be between
digits)
- int x6 = 0x_; // Illegal. (Not valid with the underscore
removed)
-
- int x9 = 052_; // Illegal. (Underscores must always be between
digits)
- '''
+ @ParameterizedTest
+ @ValueSource(strings=[
+ 'int x2 = 5_2; assert x2==52', // OK. (Decimal literal)
+ 'int x3 = 5_______2; assert x3==52', // OK. (Decimal literal.)
+ 'int x6 = 0x5_2; assert x6==82', // OK. (Hexadecimal literal)
+ 'int x7 = 0_52; assert x7==42', // OK. (Octal literal)
+ 'int x8 = 05_2; assert x8==42', // OK. (Octal literal)
+ ])
+ void testValidPlacementOfUnderscore(String declaration) {
+ assertScript(declaration)
}
- @Test
- void testInvalidPlacementOfUnderscore() {
- shouldNotCompile ''' def i = 10101_ '''
- shouldNotCompile ''' def d = 10101_.0 '''
- shouldNotCompile ''' def d = 10101.0_ '''
+ @ParameterizedTest
+ @ValueSource(strings=[
+ 'def i = 10101_' , // Illegal: Underscores must always be between
digits
+ 'def d = 10101_.0', // Illegal: Underscores must always be between
digits
+ 'def d = 10101.0_', // Illegal: Underscores must always be between
digits
+ 'int x2 = 52_;' , // Illegal: Underscores must always be between
digits
+ 'int x4 = 0_x52;' , // Illegal: Can't put underscores in the "0x"
radix prefix
+ 'int x5 = 0x_52;' , // Illegal: Underscores must always be between
digits
+ 'int x6 = 0x52_;' , // Illegal: Underscores must always be between
digits
+ 'int x6 = 0x_;' , // Illegal: Not valid with the underscore removed
+ 'int x9 = 052_;' , // Illegal: Underscores must always be between
digits
+ ])
+ void testInvalidPlacementOfUnderscore(String declaration) {
+ shouldFail(declaration)
}
}
diff --git
a/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/Groovy7222OptimizationsTest.groovy
b/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/Groovy7222OptimizationsTest.groovy
index 1ae7513680..2929487de1 100644
---
a/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/Groovy7222OptimizationsTest.groovy
+++
b/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/Groovy7222OptimizationsTest.groovy
@@ -88,27 +88,32 @@ final class Groovy7222OptimizationsTest extends
StaticTypeCheckingTestCase imple
@Test
void testShouldNotContainBigDecimalInBytecode() {
- try {
- assertScript '''
- double d = 2.5 // forgot to add the 'd' so normally implies
new BigDecimal
- '''
- } finally {
- def bytecode = astTrees.entrySet().find { it.key =~ /BigDecimal/
}.value[1]
- assert bytecode.contains('LDC 2.5')
- assert bytecode.contains('DSTORE')
- assert !bytecode.contains('java/math/BigDecimal')
- }
+ assertScript '''
+ class C {
+ void m() {
+ double d = 2.5 // forgot to add the 'd' so normally
implies new BigDecimal
+ }
+ }
+
+ new C().m()
+ '''
+
+ String bytecode = astTrees['C'][1]
+ bytecode = bytecode.substring(bytecode.indexOf('m()V'))
+
+ assert bytecode.contains('LDC 2.5D')
+ assert bytecode.contains('DSTORE 1')
+ assert !bytecode.contains('java/math/BigDecimal')
}
@Test
void testShouldNotThrowNPE() {
assertScript '''
- @groovy.transform.CompileStatic
- void foo() {
- Double d = null
+ void m() {
+ Double d = null
}
- foo()
+ m()
'''
}
}
diff --git
a/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/StaticCompileCastOptimizationTest.groovy
b/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/StaticCompileCastOptimizationTest.groovy
index 6e04820a40..98c59f3500 100644
---
a/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/StaticCompileCastOptimizationTest.groovy
+++
b/src/test/groovy/org/codehaus/groovy/classgen/asm/sc/StaticCompileCastOptimizationTest.groovy
@@ -28,79 +28,61 @@ final class StaticCompileCastOptimizationTest extends
StaticTypeCheckingTestCase
@Test
void testShouldOptimizeAsTypeToSimpleCast() {
- try {
- assertScript '''
- int x = 2
- long y = x as long // asType, where it could be a cast
- '''
- } finally {
- def bytecode = astTrees.entrySet().find { it.key =~
/ShouldOptimize/ }.value[1]
- assert bytecode.contains('I2L')
- }
+ assertScript '''
+ int x = 2
+ long y = x as long // asType, where it could be a cast
+ '''
+ String bytecode = astTrees.values()[0][1]
+ assert bytecode.contains('I2L')
}
@Test
void testShouldOptimizeCharToLongAsTypeToSimpleCast() {
- try {
- assertScript '''
- char x = 2
- long y = x as long // asType, where it could be a cast
- '''
- } finally {
- def bytecode = astTrees.entrySet().find { it.key =~
/ShouldOptimize/ }.value[1]
- assert bytecode.contains('I2L')
- }
+ assertScript '''
+ char x = 2
+ long y = x as long // asType, where it could be a cast
+ '''
+ String bytecode = astTrees.values()[0][1]
+ assert bytecode.contains('I2L')
}
@Test
void testShouldOptimizeLongToCharAsTypeToSimpleCast() {
- try {
- assertScript '''
- long x = 2L
- char y = x as char // asType, where it could be a cast
- '''
- } finally {
- def bytecode = astTrees.entrySet().find { it.key =~
/ShouldOptimize/ }.value[1]
- assert bytecode.contains('L2I') && bytecode.contains('I2C')
- }
+ assertScript '''
+ long x = 2L
+ char y = x as char // asType, where it could be a cast
+ '''
+ String bytecode = astTrees.values()[0][1]
+ assert bytecode.contains('L2I') && bytecode.contains('I2C')
}
@Test
void testShouldOptimizeListLiteralToArrayCast() {
- try {
- assertScript '''
- def x = ['a','b','c'] as String[]
- '''
- } finally {
- def bytecode = astTrees.entrySet().find { it.key =~
/ShouldOptimize/ }.value[1]
- assert bytecode.contains('ANEWARRAY java/lang/String')
- }
+ assertScript '''
+ def x = ['a','b','c'] as String[]
+ '''
+ String bytecode = astTrees.values()[0][1]
+ assert bytecode.contains('ANEWARRAY java/lang/String')
}
@Test
void testShouldOptimizeListLiteralToArrayCastWithIncompatibleElementType()
{
- try {
- assertScript '''
- def x = ['a','b',new Date()] as String[]
- '''
- } finally {
- def bytecode = astTrees.entrySet().find { it.key =~
/ShouldOptimize/ }.value[1]
- assert bytecode.contains('ANEWARRAY java/lang/String')
- }
+ assertScript '''
+ def x = ['a','b',new Date()] as String[]
+ '''
+ String bytecode = astTrees.values()[0][1]
+ assert bytecode.contains('ANEWARRAY java/lang/String')
}
@Test
void testShouldOptimizeListLiteralToArrayCastThroughParameter() {
- try {
- assertScript '''
- int foo(String[] args) {
- args.length
- }
- assert foo(['a','b',new Date()] as String[]) == 3
- '''
- } finally {
- def bytecode = astTrees.entrySet().find { it.key =~
/ShouldOptimize/ }.value[1]
- assert bytecode.contains('ANEWARRAY java/lang/String')
- }
+ assertScript '''
+ int foo(String[] args) {
+ args.length
+ }
+ assert foo(['a','b',new Date()] as String[]) == 3
+ '''
+ String bytecode = astTrees.values()[0][1]
+ assert bytecode.contains('ANEWARRAY java/lang/String')
}
}
diff --git a/src/testFixtures/groovy/gls/CompilableTestSupport.groovy
b/src/testFixtures/groovy/gls/CompilableTestSupport.groovy
index 0db79a01af..9dd3a1ac24 100644
--- a/src/testFixtures/groovy/gls/CompilableTestSupport.groovy
+++ b/src/testFixtures/groovy/gls/CompilableTestSupport.groovy
@@ -22,48 +22,42 @@ import groovy.test.GroovyAssert
import groovy.transform.AutoFinal
import groovy.transform.CompileStatic
import org.codehaus.groovy.control.CompilationFailedException
-import org.junit.jupiter.api.BeforeEach
-import org.junit.jupiter.api.TestInfo
-
-import java.util.concurrent.atomic.AtomicInteger
import static org.junit.jupiter.api.Assertions.fail
@AutoFinal @CompileStatic
abstract class CompilableTestSupport {
- String methodName
-
- @BeforeEach
- final void setUpTestCase(TestInfo testInfo) {
- methodName = testInfo.getTestMethod().orElseThrow().getName()
- }
-
- private static final AtomicInteger scriptFileNameCounter = new
AtomicInteger(0)
-
- private String getTestClassName() {
-
"TestScript${getMethodName()}${scriptFileNameCounter.getAndIncrement()}.groovy"
+ private static String getTestScriptName() {
+ String uuid = UUID.randomUUID()
+ new StringBuilder('TestScript')
+ .append(uuid, 0, 8)
+ .append(uuid, 9, 13)
+ .append(uuid, 14, 18)
+ .append(uuid, 19, 23)
+ .append(uuid, 24, 36)
+ .append('.groovy')
}
//--------------------------------------------------------------------------
- protected final Object assertScript(String script) {
- new GroovyShell().evaluate(script, testClassName)
+ protected static Object assertScript(String script) {
+ new GroovyShell().evaluate(script,testScriptName)
}
- protected final String shouldFail(String script) {
+ protected static String shouldFail(String script) {
GroovyAssert.shouldFail(script).getMessage()
}
- protected final void shouldCompile(String script) {
+ protected static void shouldCompile(String script) {
try (def gcl = new GroovyClassLoader()) {
- gcl.parseClass(script, testClassName)
+ gcl.parseClass(script,testScriptName)
}
}
- protected final String shouldNotCompile(String script) {
+ protected static String shouldNotCompile(String script) {
try (def gcl = new GroovyClassLoader()) {
- gcl.parseClass(script, testClassName)
+ gcl.parseClass(script,testScriptName)
} catch (CompilationFailedException ex) {
return ex.message
}
diff --git
a/src/testFixtures/groovy/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
b/src/testFixtures/groovy/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
index 694a0db4c9..b244bda590 100644
---
a/src/testFixtures/groovy/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
+++
b/src/testFixtures/groovy/groovy/transform/stc/StaticTypeCheckingTestCase.groovy
@@ -28,7 +28,6 @@ import
org.codehaus.groovy.control.customizers.ImportCustomizer
import org.codehaus.groovy.control.messages.SyntaxErrorMessage
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
-import org.junit.jupiter.api.TestInfo
/**
* Support class for static type checking test cases.
@@ -64,26 +63,25 @@ abstract class StaticTypeCheckingTestCase {
//--------------------------------------------------------------------------
- private String testMethodName
- private int testScriptCounter
-
- @BeforeEach
- void setUpTestName(TestInfo testInfo) {
- testMethodName = testInfo.getTestMethod().orElseThrow().getName()
- }
-
- protected final String getTestClassName() {
- "TestScript" + testMethodName + (++testScriptCounter) + ".groovy"
+ private static String getTestScriptName() {
+ String uuid = UUID.randomUUID()
+ new StringBuilder('TestScript')
+ .append(uuid, 0, 8)
+ .append(uuid, 9, 13)
+ .append(uuid, 14, 18)
+ .append(uuid, 19, 23)
+ .append(uuid, 24, 36)
+ .append('.groovy')
}
protected final Object assertScript(String script) {
- shell.evaluate(script, getTestClassName())
+ shell.evaluate(script, getTestScriptName())
}
- protected final void shouldFailWithMessages(String code, String...
messages) {
+ protected final void shouldFailWithMessages(String script, String...
messages) {
boolean success = false
try {
- shell.evaluate(code, getTestClassName())
+ shell.evaluate(script, getTestScriptName())
} catch (MultipleCompilationErrorsException mce) {
success = messages.every { message ->
mce.errorCollector.errors.any {
diff --git
a/src/testFixtures/groovy/org/codehaus/groovy/classgen/TestSupport.java
b/src/testFixtures/groovy/org/codehaus/groovy/classgen/TestSupport.java
index a176e9efa3..7c3811aeea 100644
--- a/src/testFixtures/groovy/org/codehaus/groovy/classgen/TestSupport.java
+++ b/src/testFixtures/groovy/org/codehaus/groovy/classgen/TestSupport.java
@@ -35,7 +35,6 @@ import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.groovy.runtime.InvokerHelper;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.TestInfo;
import org.objectweb.asm.Opcodes;
import java.beans.BeanInfo;
@@ -59,7 +58,15 @@ public abstract class TestSupport implements Opcodes {
* Asserts the script runs without any exceptions.
*/
protected final void assertScript(String scriptText) throws Exception {
- String scriptName = "TestScript" + testMethodName +
(++testScriptCounter) + ".groovy";
+ String id = java.util.UUID.randomUUID().toString();
+ String scriptName = new StringBuilder("TestScript")
+ .append(id, 0, 8)
+ .append(id, 9, 13)
+ .append(id, 14, 18)
+ .append(id, 19, 23)
+ .append(id, 24, 36)
+ .append(".groovy")
+ .toString();
Class<?> scriptClass = loader.parseClass(doPrivileged(() ->
new GroovyCodeSource(scriptText, scriptName, "/groovy/testSupport")
));
@@ -120,14 +127,11 @@ public abstract class TestSupport implements Opcodes {
//--------------------------------------------------------------------------
private GroovyClassLoader loader;
- private String testMethodName;
- private int testScriptCounter;
@BeforeEach
- void setUpTestCase(TestInfo testInfo) throws Exception {
+ void setUpTestCase() throws Exception {
ClassLoader parentLoader = getClass().getClassLoader();
loader = doPrivileged(() -> new GroovyClassLoader(parentLoader));
- testMethodName = testInfo.getTestMethod().orElseThrow().getName();
}
@AfterEach