Skip to content

Instantly share code, notes, and snippets.

@kiy0taka
Created May 17, 2013 10:31
Show Gist options
  • Save kiy0taka/5598305 to your computer and use it in GitHub Desktop.
Save kiy0taka/5598305 to your computer and use it in GitHub Desktop.
@Grapes([
@Grab('org.spockframework:spock-core:0.7-groovy-2.0'),
@GrabExclude('org.codehaus.groovy:groovy-all')])
import spock.lang.*
class HelloSpock extends Specification {
def "おーるどどーなってんの?"() {
setup:
def list = [1, 2, 3]
when:
list << 4
then:
list.size() == old(list.size()) + 1
}
}
@groovy.lang.Grapes(value = ['spock-core''org.spockframework''0.7-groovy-2.0'org.codehaus.groovy.ast.AnnotationNode@6ea0fbf0, 'groovy-all''org.codehaus.groovy'org.codehaus.groovy.ast.AnnotationNode@afc824e])
import spock.lang.*
@org.spockframework.runtime.model.SpecMetadata(line = 6, filename = 'script1368786686341.groovy')
public class HelloSpock extends spock.lang.Specification {
static {
groovy.grape.Grape.grab(['excludes': [['module': 'groovy-all', 'group': 'org.codehaus.groovy']]], ['group': 'org.spockframework', 'module': 'spock-core', 'version': '0.7-groovy-2.0'])
}
@org.spockframework.runtime.model.FeatureMetadata(parameterNames = [], name = 'おーるどどーなってんの?', line = 8, ordinal = 0, blocks = [[]org.spockframework.runtime.model.BlockKind.SETUPorg.codehaus.groovy.ast.AnnotationNode@75b8fdf2, []org.spockframework.runtime.model.BlockKind.WHENorg.codehaus.groovy.ast.AnnotationNode@2782f364, []org.spockframework.runtime.model.BlockKind.THENorg.codehaus.groovy.ast.AnnotationNode@6393e80])
public void $spock_feature_0_0() {
java.lang.Object $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder()
java.lang.Object list = [1, 2, 3]
java.lang.Object $spock_oldValue0 = list.size()
list << 4
org.spockframework.runtime.SpockRuntime.verifyCondition($spock_valueRecorder.reset(), 'list.size() == old(list.size()) + 1', 16, 9, null, $spock_valueRecorder.record(12, $spock_valueRecorder.record(3, $spock_valueRecorder.record(0, list).$spock_valueRecorder.record(1, 'size')()) == $spock_valueRecorder.record(11, $spock_valueRecorder.record(10, this.$spock_valueRecorder.record(4, 'oldImpl')($spock_oldValue0)) + 1)))
this.getSpecificationContext().getMockController().leaveScope()
}
}
@uehaj
Copy link

uehaj commented May 20, 2013

ありがとん! 画期的ですな。これはすごい。副作用があったらわけわからんことになりそうですけど。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment