Skip to content

Commit a0e43d6

Browse files
authored
Merge branch 'master' into more-to-build-logic
2 parents a592695 + 069ee92 commit a0e43d6

File tree

13 files changed

+185
-73
lines changed

13 files changed

+185
-73
lines changed

.github/renovate.json5

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,29 @@
1111
// as we want to keep one for each major version.
1212
// The same applies for mockito as we test with both 4 and 5
1313
{
14-
matchPackagePrefixes: ["org.codehaus.groovy:"],
14+
matchPackageNames: ["/^org.codehaus.groovy:/"],
1515
matchCurrentValue: "/^2\\./",
1616
allowedVersions: "(,3.0)"
1717
},
1818
{
19-
matchPackagePrefixes: ["org.apache.groovy:"],
19+
matchPackageNames: ["/^org.apache.groovy:/"],
2020
matchCurrentValue: "/^4\\./",
2121
allowedVersions: "(,5.0)"
2222
},
2323
{
24-
matchPackagePrefixes: ["org.mockito:"],
24+
matchPackageNames: ["/^org.mockito:/"],
2525
matchCurrentValue: "/^4\\./",
2626
allowedVersions: "(,5.0)"
27+
},
28+
{
29+
matchPackageNames: ["/^org.spockframework:spock-/"],
30+
matchCurrentVersion: "/-groovy-3\\.0$/",
31+
allowedVersions: "/-groovy-3\\.0$/"
32+
},
33+
{
34+
matchPackageNames: ["/^org.spockframework:spock-/"],
35+
matchCurrentVersion: "/-groovy-4\\.0$/",
36+
allowedVersions: "/-groovy-4\\.0$/"
2737
}
2838
]
2939
}

docs/release_notes.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ include::include.adoc[]
99

1010
* Fix ExtensionException in OSGi environment for global extension spockIssue:2076[]
1111
** This issue was introduced with spockPull:1995[]
12+
* Fix `@RestoreSystemProperties` not restoring state between iterations of a data-driven feature spockIssue:2104[]
1213

1314
== 2.4-M5 (2025-01-07)
1415

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
asciidoctorj = '2.5.13'
33
groovy2 = '2.5.23'
44
groovy3 = '3.0.23'
5-
groovy4 = '4.0.24'
5+
groovy4 = '4.0.25'
66
jacoco = '0.8.12'
77
junit = '5.11.4'
88
asm = '9.7.1'
99
mockito4 = '4.11.0'
1010
mockito5 = '5.15.2'
11-
workflows-kotlin = "2.1.0"
11+
workflows-kotlin = "2.1.10"
1212

1313
[libraries]
14-
jetbrains-annotations = "org.jetbrains:annotations:26.0.1"
14+
jetbrains-annotations = "org.jetbrains:annotations:26.0.2"
1515
asciidoctorj = { module = "org.asciidoctor:asciidoctorj", version.ref = "asciidoctorj" }
1616
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
1717
asmUtil = { module = "org.ow2.asm:asm-util", version.ref = "asm" }
18-
bytebuddy = "net.bytebuddy:byte-buddy:1.16.1"
18+
bytebuddy = "net.bytebuddy:byte-buddy:1.17.0"
1919
cglib = "cglib:cglib-nodep:3.3.0"
2020
geantyref = "io.leangen.geantyref:geantyref:1.3.16"
2121
h2database = "com.h2database:h2:2.2.224"

gradle/wrapper/gradle-wrapper.jar

122 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
3+
distributionSha256Sum=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
55
networkTimeout=10000
66
validateDistributionUrl=true
77
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

settings.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ pluginManagement {
77
}
88

99
plugins {
10-
id "com.gradle.develocity" version "3.19"
11-
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.0.2"
10+
id "com.gradle.develocity" version "3.19.2"
11+
id "com.gradle.common-custom-user-data-gradle-plugin" version "2.1"
1212
id "org.asciidoctor.jvm.convert" version "4.0.4"
1313
id "net.nemerosa.versioning" version "3.1.0"
1414
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
15-
id "com.github.ben-manes.versions" version "0.51.0"
15+
id "com.github.ben-manes.versions" version "0.52.0"
1616
id "biz.aQute.bnd.builder" version "7.1.0"
1717
id "io.spring.nohttp" version "0.0.11"
1818
}

spock-core/src/main/java/org/spockframework/runtime/extension/builtin/RestoreSystemPropertiesExtension.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ public class RestoreSystemPropertiesExtension implements IStatelessAnnotationDri
3030
public void visitSpecAnnotation(RestoreSystemProperties annotation, SpecInfo spec) {
3131
spec.addExclusiveResource(EXCLUSIVE_RESOURCE);
3232
for (FeatureInfo feature : spec.getFeatures()) {
33-
feature.addInterceptor(RestoreSystemPropertiesInterceptor.INSTANCE);
33+
feature.addIterationInterceptor(RestoreSystemPropertiesInterceptor.INSTANCE);
3434
}
3535
}
3636

3737
@Override
3838
public void visitFeatureAnnotation(RestoreSystemProperties annotation, FeatureInfo feature) {
39-
feature.addInterceptor(RestoreSystemPropertiesInterceptor.INSTANCE);
39+
feature.addIterationInterceptor(RestoreSystemPropertiesInterceptor.INSTANCE);
4040
feature.addExclusiveResource(EXCLUSIVE_RESOURCE);
4141
}
4242
}

spock-core/src/main/java/org/spockframework/util/RenderUtil.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.spockframework.runtime.GroovyRuntimeUtil;
44

55
import java.util.*;
6+
import java.util.function.Function;
67

78
import groovy.lang.Range;
89
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
@@ -52,7 +53,10 @@ public static String toStringOrDump(@Nullable Object value) {
5253
Wrapper wrapper = (Wrapper) value;
5354
return String.format("%s as %s", toStringOrDump(wrapper.unwrap()), wrapper.getType().getSimpleName());
5455
}
55-
return dump(value);
56+
if (value.getClass().isArray()) {
57+
return dumpArrayString((Object[]) value, RenderUtil::toStringOrDump);
58+
}
59+
return DefaultGroovyMethods.dump(value);
5660
}
5761

5862
public static String inspectOrDump(@Nullable Object value) {
@@ -63,28 +67,22 @@ public static String inspectOrDump(@Nullable Object value) {
6367
Wrapper wrapper = (Wrapper) value;
6468
return String.format("%s as %s", inspectOrDump(wrapper.unwrap()), wrapper.getType().getSimpleName());
6569
}
66-
return dump(value);
67-
}
68-
69-
private static String dump(@Nullable Object value) {
7070
if (value.getClass().isArray()) {
71-
return dumpArrayString((Object[])value);
72-
} else {
73-
return DefaultGroovyMethods.dump(value);
71+
return dumpArrayString((Object[]) value, RenderUtil::inspectOrDump);
7472
}
73+
return DefaultGroovyMethods.dump(value);
7574
}
7675

77-
7876
/*
7977
* Adapted from org.codehaus.groovy.runtime.InvokerHelper.toArrayString(java.lang.Object[]) to use dump()
8078
*/
81-
private static String dumpArrayString(Object[] arguments) {
79+
private static String dumpArrayString(Object[] arguments, Function<Object, String> argDumper) {
8280
StringBuilder argBuf = new StringBuilder("[");
8381
for (int i = 0; i < arguments.length; i++) {
8482
if (i > 0) {
8583
argBuf.append(", ");
8684
}
87-
argBuf.append(DefaultGroovyMethods.dump(arguments[i]));
85+
argBuf.append(argDumper.apply(arguments[i]));
8886
}
8987
argBuf.append("]");
9088
return argBuf.toString();
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package org.spockframework.smoke.condition
2+
3+
import static org.spockframework.smoke.condition.ValueRendering.DefaultToString
4+
5+
class ArrayComparisonRendering extends ConditionRenderingSpec {
6+
7+
def "primitive array value"() {
8+
expect:
9+
isRendered """
10+
x == null
11+
| |
12+
| false
13+
[1, 2]
14+
""", {
15+
def x = [1, 2] as int[]
16+
assert x == null
17+
}
18+
}
19+
20+
def "object array value"() {
21+
expect:
22+
isRendered """
23+
x == null
24+
| |
25+
| false
26+
[one, two]
27+
""", {
28+
def x = ["one", "two"] as String[]
29+
assert x == null
30+
}
31+
}
32+
33+
def "arrays of variables with default to string is dump()ed"() {
34+
def a = new DefaultToString()
35+
def b = new DefaultToString()
36+
DefaultToString[] x = [a, b]
37+
expect:
38+
isRendered """
39+
x == null
40+
| |
41+
| false
42+
[${a.dump()}, ${b.dump()}]
43+
""", {
44+
assert x == null
45+
}
46+
}
47+
48+
def "primitive two-dimensional array value"() {
49+
expect:
50+
isRendered """
51+
x == y
52+
| | |
53+
| | [[1, 2], [1, 5]]
54+
| false
55+
[[1, 2], [2, 5]]
56+
""", {
57+
def x = [[1, 2], [2, 5]] as int[][]
58+
def y = [[1, 2], [1, 5]] as int[][]
59+
assert x == y
60+
}
61+
}
62+
63+
def "object two-dimensional array value"() {
64+
expect:
65+
isRendered """
66+
x == y
67+
| | |
68+
| | [[one, two], [one, five]]
69+
| false
70+
[[one, two], [two, five]]
71+
""", {
72+
def x = [["one", "two"], ["two", "five"]] as String[][]
73+
def y = [["one", "two"], ["one", "five"]] as String[][]
74+
assert x == y
75+
}
76+
}
77+
78+
def "multidimensional array value with higher cardinality"() {
79+
expect:
80+
isRendered """
81+
x == y
82+
| | |
83+
| | [[[1, 2], [1, 5]], [[1, 2], [1, 5]]]
84+
| false
85+
[[[1, 2], [2, 5]], [[1, 2], [2, 5]]]
86+
""", {
87+
def x = [[[1, 2], [2, 5]], [[1, 2], [2, 5]]] as int[][][]
88+
def y = [[[1, 2], [1, 5]], [[1, 2], [1, 5]]] as int[][][]
89+
assert x == y
90+
}
91+
}
92+
93+
}

0 commit comments

Comments
 (0)