-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating to Spock 2, some errors happen when using parameter named build
#1200
Comments
Hm, very interesting. import spock.lang.Specification
class Foo extends Specification {
def foo() {
given:
def build = Stub()
build.toString() >> null
expect:
true
}
} where this.getSpecificationContext().getMockController().addInteraction(build.call()) instead of this.getSpecificationContext().getMockController().addInteraction(new org.spockframework.mock.runtime.InteractionBuilder(7, 9, 'build.toString() >> null').addEqualTarget(build).addEqualMethodName('toString').setArgListKind(true, false).addConstantResponse(null).build()) Btw. your project does not build @etiennestuder, it complains that it cannot run |
And during debugging it seems to create the correct code. :-/ |
@Vampire It's a Gradle build. You can run it with ./gradlew.bat on Windows. |
@Vampire Thanks for having looked into it. I hope you find |
I know the one best build tool in the world and I'm even a contributor. ;-) |
My apologies, I finally got what you mean. This is what you were referring to: I fixed it: Thanks for letting me know. |
Regarding the reported problem, it is a Groovy bug: https://issues.apache.org/jira/browse/GROOVY-9651. |
Cool. Thanks @Vampire |
…troy the method call (#1200) This happened due to a buggy VariableScopeVisitor as reported in https://issues.apache.org/jira/browse/GROOVY-9651
…troy the method call (#1201) This happened due to a buggy VariableScopeVisitor as reported in https://issues.apache.org/jira/browse/GROOVY-9651 fixes #1200
Thanks, @leonard84 . |
Issue description
When migrating to Spock 2, some tests previously green started failing. As crazy as it sounds, it turned out that renaming the parameters named
build
holding aMock
to some other name made the tests green again.How to reproduce
gradlew build
sbuild
tobuild
hereLink to a gist or similar (optional)
See this code change which turns the red tests back into green tests:
etiennestuder/teamcity-build-scan-plugin@75bfa6d#diff-9dac7f911ea3895bc8e7af5798850b91R26
Additional Environment information
Gradle 6.6-rc-2
Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 13.0.2 (Oracle Corporation 13.0.2+8)
OS: Mac OS X 10.15.6 x86_64
Java/JDK
openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
Build-tool dependencies used
Gradle/Grails
dependencies {
testImplementation 'org.spockframework:spock-core:2.0-M3-groovy-2.5'
testImplementation 'org.spockframework:spock-junit4:2.0-M3-groovy-2.5'
}
test {
useJUnitPlatform()
}
The text was updated successfully, but these errors were encountered: