You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure whether the example above is a regression, because I think the behaviour in M7 (asserting the return value of with{}) seems more consistent than the previous behaviour. I just wanted to report this, as it breaks existing test cases, so this new behaviour should at least be clearly documented.
This actually just was a bug-fix.
Spock behaved wrong, as it confused the GDK with method with our own with method and did then some rewriting, but also just half rewriting.
If you for example have
expect:
assertnull.with {
false
}
the test also was successful as the rewriting did remove the assert but did not add our power assertion code, so no assertion was checked here.
The two cases you listed are like you said, previously handled wrong by Spock,
as Spock should check the top-level expression as implicit assertion and did not, as for the first the value of the expression is null, for the second false.
If anything breaks due to that change, it was because the tests relied on this bug which was not a good idea in the first place I'd say.
This PR by me fixed those cases and some others: #2162
Not sure whether we should list the fixing of a bug in Spock as breaking change if it only breaks code that relied on a bug. 🤷♂️
Not sure whether we should list the fixing of a bug in Spock as breaking change if it only breaks code that relied on a bug.
I would say we should not list it as breaking change.
But maybe add a note to the release notes, that this bug was now fixed regarding the with method, and tests relying on the spock bug may break. @Vampire what do you think?
Activity
lukasgraef commentedon Nov 24, 2025
@AndreasTu
FYI
Vampire commentedon Nov 24, 2025
This actually just was a bug-fix.
Spock behaved wrong, as it confused the GDK
withmethod with our ownwithmethod and did then some rewriting, but also just half rewriting.If you for example have
the test also was successful as the rewriting did remove the
assertbut did not add our power assertion code, so no assertion was checked here.The two cases you listed are like you said, previously handled wrong by Spock,
as Spock should check the top-level expression as implicit assertion and did not, as for the first the value of the expression is
null, for the secondfalse.If anything breaks due to that change, it was because the tests relied on this bug which was not a good idea in the first place I'd say.
This PR by me fixed those cases and some others: #2162
Not sure whether we should list the fixing of a bug in Spock as breaking change if it only breaks code that relied on a bug. 🤷♂️
AndreasTu commentedon Nov 24, 2025
I would say we should not list it as breaking change.
But maybe add a note to the release notes, that this bug was now fixed regarding the
withmethod, and tests relying on the spock bug may break.@Vampire what do you think?
Clarify Fix handling of condition method calls
[-]Possible Regression in Spock 2.4-M7[/-][+]Groovy with method bug fix in Spock 2.4-M7[/+]Vampire commentedon Nov 24, 2025
I don't have too strong feelings about it.
But sounds good to me. :-)
AndreasTu commentedon Nov 24, 2025
I have created the PR #2270 to update the ReleaseNotes.
Clarify Fix handling of condition method calls (spockframework#2270)
Vampire commentedon Nov 27, 2025
Just for future readers here too,
you can mitigate the change by either using the implicit assertion opt-out operator
!!or the Spockwithlike: