Run this repo case: https://gist.github.com/Pyrolistical/8741574
Run with "groovy bug.groovy"
Version: Spock: 0.7-groovy-2.0 $ groovy -v Groovy Version: 2.2.1 JVM: 1.7.0_40 Vendor: Oracle Corporation OS: Mac OS X
I get the failure: $ groovy bug.groovy Caught: java.lang.VerifyError: (class: BuggedTest, method: $spock_feature_0_0 signature: ()V) Stack size too large java.lang.VerifyError: (class: BuggedTest, method: $spock_feature_0_0 signature: ()V) Stack size too large
There is something wrong with the generated code. There is some poor interaction with calling helperMethod() and putting the result into an array.
Things that avoid this bug: 1. inline the helperMethod() 2. change the then: to "assert true" 3. change the when: to "assert thing == null" 4. move the def thing into the given: 5. remove the list literal around helperMethod()
It has been talked about here: https://groups.google.com/forum/#!topic/spockframework/vKRej9PJ5B0 But never solved.
Comment #1
Posted on Jan 31, 2014 by Swift CatAnother way to avoid the bug is to put new line char after [
The fact whitespace avoids the bug tells me something is seriously wrong with the way the spec is transformed into the generated code
Comment #2
Posted on Jan 31, 2014 by Grumpy CatWorks just fine for me.
Comment #3
Posted on Feb 27, 2015 by Happy KangarooI have a situation that I think is the same bug. In a Geb spec, I have the following class:
@Stepwise abstract class AbstractAboutPageSpec extends Specification { abstract Class page()
def "page loads"() {
when: to page();
then: {}
}
}
This produces a VerifyError on run: java.lang.VerifyError: (class: com/artsquare/gallery/acceptance/ui/AbstractAboutPageSpec, method: $spock_feature_3_0 signature: ()V) Stack size too large at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2575) at java.lang.Class.getDeclaredFields(Class.java:1908) at org.spockframework.runtime.SpecInfoBuilder.buildFields(SpecInfoBuilder.java:98) at org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:69) at org.spockframework.runtime.SpecInfoBuilder.buildSuperSpec(SpecInfoBuilder.java:80) at org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:67) at org.spockframework.runtime.SpecInfoBuilder.build(SpecInfoBuilder.java:54) at org.spockframework.runtime.Sputnik.getSpec(Sputnik.java:80) at org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:88) at org.spockframework.runtime.Sputnik.getDescription(Sputnik.java:55) at org.junit.runner.Runner.testCount(Runner.java:41)
Modifying the spec so that the method is called in a given: block fixes the problem:
def "page loads"() {
given: Class<AboutPage> page = page()
when: to page
then: {}
}
Status: New
Labels:
Type-Defect
Module-Core