From 2012703a1ef8c4d9dabba0d4df9479fd81af1a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20Br=C3=BCnings?= Date: Sun, 23 Jun 2024 19:02:50 +0200 Subject: [PATCH] Use BlockInfo from SpecInfo via an index lookup --- .../compiler/SpecAnnotator.java | 4 + .../spockframework/compiler/SpecParser.java | 6 + .../spockframework/compiler/SpecRewriter.java | 12 +- .../compiler/model/AnonymousBlock.java | 5 + .../spockframework/compiler/model/Block.java | 21 +++ .../spockframework/runtime/SpockRuntime.java | 6 +- .../runtime/RunListenerSpec.groovy | 1 - .../spockframework/smoke/ast/BlocksAst.groovy | 88 +++++++++ ...d_in_AST_transformation_Groovy____3.groovy | 112 ++---------- ...d_in_AST_transformation_Groovy____4.groovy | 170 ++---------------- ...ceFeatureBody_can_render_everything.groovy | 4 +- ...n_render_everything__Groovy_4_0_2__.groovy | 4 +- ...thods_and_its_annotation_by_default.groovy | 4 +- ...ers_and_their_annotation_by_default.groovy | 4 +- ...servable_blocks_with_GString_labels.groovy | 40 +++++ ...observable_blocks_with_empty_labels.groovy | 50 ++++++ ...vable_blocks_with_labels_and_blocks.groovy | 52 ++++++ ...rite_keeps_correct_method_reference.groovy | 12 +- ...hod_reference_for_multi_assignments.groovy | 12 +- .../DataAstSpec/multi_parameterization.groovy | 4 +- .../nested_multi_parameterization.groovy | 4 +- ...ith__separators_can_be_combined-[0].groovy | 4 +- ...ith__separators_can_be_combined-[1].groovy | 4 +- ...ith__separators_can_be_combined-[2].groovy | 4 +- ...filter_block_becomes_its_own_method.groovy | 8 +- ...tionsAsSet_is_transformed_correctly.groovy | 8 +- ...InAnyOrder_is_transformed_correctly.groovy | 8 +- ...onditions_are_transformed_correctly.groovy | 8 +- ...onditions_are_transformed_correctly.groovy | 8 +- ...rite_keeps_correct_method_reference.groovy | 8 +- ...hod_reference_for_multi_assignments.groovy | 8 +- .../MocksAstSpec/simple_interaction.groovy | 12 +- 32 files changed, 357 insertions(+), 338 deletions(-) create mode 100644 spock-specs/src/test/groovy/org/spockframework/smoke/ast/BlocksAst.groovy create mode 100644 spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy create mode 100644 spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy create mode 100644 spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy diff --git a/spock-core/src/main/java/org/spockframework/compiler/SpecAnnotator.java b/spock-core/src/main/java/org/spockframework/compiler/SpecAnnotator.java index 877203e093..25061a9e23 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/SpecAnnotator.java +++ b/spock-core/src/main/java/org/spockframework/compiler/SpecAnnotator.java @@ -30,6 +30,7 @@ import org.codehaus.groovy.ast.*; import org.codehaus.groovy.ast.expr.*; +import org.spockframework.util.Assert; import static java.util.stream.Collectors.*; import static org.spockframework.compiler.AstUtil.*; @@ -205,6 +206,9 @@ private void addBlockMetadata(Block block, BlockKind kind) { for (String text : block.getDescriptions()) textExprs.addExpression(new ConstantExpression(text)); blockAnn.setMember(BlockMetadata.TEXTS, textExprs); + int index = blockAnnElems.getExpressions().size(); + Assert.that(index == block.getBlockMetaDataIndex(), + () -> kind+" block mismatch of index: " + index + ", block.getBlockMetaDataIndex(): " + block.getBlockMetaDataIndex()); blockAnnElems.addExpression(new AnnotationConstantExpression(blockAnn)); } diff --git a/spock-core/src/main/java/org/spockframework/compiler/SpecParser.java b/spock-core/src/main/java/org/spockframework/compiler/SpecParser.java index f7a32ffb8b..6659d24d5b 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/SpecParser.java +++ b/spock-core/src/main/java/org/spockframework/compiler/SpecParser.java @@ -200,6 +200,12 @@ private void buildBlocks(Method method) throws InvalidSpecCompileException { checkIsValidSuccessor(method, BlockParseInfo.METHOD_END, method.getAst().getLastLineNumber(), method.getAst().getLastColumnNumber()); + // set the block metaData index for each block this must be equal to the index of the block in the @BlockMetadata annotation + int i = -1; + for (Block block : method.getBlocks()) { + if(!block.hasBlockMetadata()) continue; + block.setBlockMetaDataIndex(++i); + } // now that statements have been copied to blocks, the original statement // list is cleared; statements will be copied back after rewriting is done stats.clear(); diff --git a/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java b/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java index ce3b6109ab..7a0c69c138 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java +++ b/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java @@ -470,21 +470,13 @@ private IfStatement ifThrowableIsNotNull(Statement statement) { } private MethodCallExpression createBlockListenerCall(Block block, BlockParseInfo blockType, MethodNode blockListenerMethod) { + if (block.getBlockMetaDataIndex() < 0) throw new SpockException("Block metadata index not set: " + block); return createDirectMethodCall( new ClassExpression(nodeCache.SpockRuntime), blockListenerMethod, new ArgumentListExpression( getSpecificationContext(), - new ConstructorCallExpression(nodeCache.BlockInfo, - new ArgumentListExpression( - new PropertyExpression( - new ClassExpression(nodeCache.BlockKind), - blockType.name() - ), - new ListExpression( - block.getDescriptions().stream().map(ConstantExpression::new).collect(Collectors.toList()) - ) - )) + new ConstantExpression(block.getBlockMetaDataIndex(), true) )); } diff --git a/spock-core/src/main/java/org/spockframework/compiler/model/AnonymousBlock.java b/spock-core/src/main/java/org/spockframework/compiler/model/AnonymousBlock.java index fd1a7528c6..94c5224938 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/model/AnonymousBlock.java +++ b/spock-core/src/main/java/org/spockframework/compiler/model/AnonymousBlock.java @@ -37,4 +37,9 @@ public void accept(ISpecVisitor visitor) throws Exception { public BlockParseInfo getParseInfo() { return BlockParseInfo.ANONYMOUS; } + + @Override + public boolean hasBlockMetadata() { + return false; + } } diff --git a/spock-core/src/main/java/org/spockframework/compiler/model/Block.java b/spock-core/src/main/java/org/spockframework/compiler/model/Block.java index 49ba575512..1ee316b772 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/model/Block.java +++ b/spock-core/src/main/java/org/spockframework/compiler/model/Block.java @@ -31,6 +31,7 @@ public abstract class Block extends Node> { private final List descriptions = new ArrayList<>(3); private Block prev; private Block next; + private int blockMetaDataIndex = -1; public Block(Method parent) { super(parent, new ArrayList<>()); @@ -80,5 +81,25 @@ public boolean isFirstInChain() { return isFirst() || getClass() != prev.getClass(); } + public void setBlockMetaDataIndex(int blockMetaDataIndex) { + this.blockMetaDataIndex = blockMetaDataIndex; + } + + public int getBlockMetaDataIndex() { + return blockMetaDataIndex; + } + + /** + * Returns whether this block will be written to the {@link org.spockframework.runtime.model.BlockMetadata}. + */ + public boolean hasBlockMetadata() { + return true; + } + public abstract BlockParseInfo getParseInfo(); + + @Override + public String toString() { + return "Block kind: " + getClass().getSimpleName() + ", descriptions: " + descriptions; + } } diff --git a/spock-core/src/main/java/org/spockframework/runtime/SpockRuntime.java b/spock-core/src/main/java/org/spockframework/runtime/SpockRuntime.java index 5e1afd01c9..6e83507cb6 100644 --- a/spock-core/src/main/java/org/spockframework/runtime/SpockRuntime.java +++ b/spock-core/src/main/java/org/spockframework/runtime/SpockRuntime.java @@ -226,8 +226,9 @@ public static Object[] despreadList(Object[] args, Object[] spreads, int[] posit public static final String CALL_ENTER_BLOCK = "callEnterBlock"; - public static void callEnterBlock(SpecificationContext context, BlockInfo blockInfo) { + public static void callEnterBlock(SpecificationContext context, int blockInfoIndex) { IterationInfo currentIteration = context.getCurrentIteration(); + BlockInfo blockInfo = context.getCurrentFeature().getBlocks().get(blockInfoIndex); context.setCurrentBlock(blockInfo); notifyBlockListener(currentIteration, blockListener -> blockListener.blockEntered(currentIteration, blockInfo)); } @@ -240,8 +241,9 @@ private static void notifyBlockListener(IterationInfo currentIteration, Consumer public static final String CALL_EXIT_BLOCK = "callExitBlock"; - public static void callExitBlock(SpecificationContext context, BlockInfo blockInfo) { + public static void callExitBlock(SpecificationContext context, int blockInfoIndex) { IterationInfo currentIteration = context.getCurrentIteration(); + BlockInfo blockInfo = context.getCurrentFeature().getBlocks().get(blockInfoIndex); notifyBlockListener(currentIteration, blockListener -> blockListener.blockExited(currentIteration, blockInfo)); context.setCurrentBlock(null); } diff --git a/spock-specs/src/test/groovy/org/spockframework/runtime/RunListenerSpec.groovy b/spock-specs/src/test/groovy/org/spockframework/runtime/RunListenerSpec.groovy index c9af3050d2..4e0736a03e 100644 --- a/spock-specs/src/test/groovy/org/spockframework/runtime/RunListenerSpec.groovy +++ b/spock-specs/src/test/groovy/org/spockframework/runtime/RunListenerSpec.groovy @@ -234,7 +234,6 @@ class ASpec extends Specification { it.kind == block it.texts == blockTexts } - assert errorInfo.errorContext.toString() == '' } else { assert errorInfo.errorContext.currentBlock == null } diff --git a/spock-specs/src/test/groovy/org/spockframework/smoke/ast/BlocksAst.groovy b/spock-specs/src/test/groovy/org/spockframework/smoke/ast/BlocksAst.groovy new file mode 100644 index 0000000000..ccc4ba3571 --- /dev/null +++ b/spock-specs/src/test/groovy/org/spockframework/smoke/ast/BlocksAst.groovy @@ -0,0 +1,88 @@ +/* + * Copyright 2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * https://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.spockframework.smoke.ast + +import org.spockframework.EmbeddedSpecification +import org.spockframework.specs.extension.SpockSnapshotter +import spock.lang.Snapshot + +class BlocksAst extends EmbeddedSpecification { + @Snapshot(extension = 'groovy') + SpockSnapshotter snapshotter + + def "all observable blocks with empty labels"() { + given: + snapshotter.featureBody() + + when: + def result = compiler.transpileFeatureBody(''' + given: '' + expect: '' + when: '' + then: '' + cleanup: '' + where: '' + combined: '' + filter: '' + ''') + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + } + def "all observable blocks with labels and blocks"() { + given: + snapshotter.featureBody() + + when: + def result = compiler.transpileFeatureBody(''' + given: 'given' + and: 'and given' + expect: 'expect' + and: 'and expect' + when: 'when' + and: 'and when' + then: 'then' + and: 'and then' + then: 'then2' + and: 'and then2' + cleanup: 'cleanup' + and: 'and cleanup' + where: 'where' + combined: 'combine' + filter: 'only one execution' + ''') + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + } + + def "all observable blocks with GString labels"() { + given: + snapshotter.featureBody() + + when: + def result = compiler.transpileFeatureBody(''' + int idx = 0 + given: "given ${idx++}" + expect: "expect ${idx++}" + when: "when ${idx++}" + then: "then ${idx++}" + ''') + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + } +} diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____3.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____3.groovy index 4fb8ee7edd..8f16d4d117 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____3.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____3.groovy @@ -45,23 +45,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov LDC Lorg/spockframework/runtime/SpecificationContext;.class INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; CHECKCAST org/spockframework/runtime/SpecificationContext - ALOAD 1 - LDC 2 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - ALOAD 1 - LDC 3 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callGetProperty (Ljava/lang/Object;)Ljava/lang/Object; (itf) ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callConstructor (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (itf) - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; - CHECKCAST org/spockframework/runtime/model/BlockInfo - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP L0 @@ -116,23 +101,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov LDC Lorg/spockframework/runtime/SpecificationContext;.class INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; CHECKCAST org/spockframework/runtime/SpecificationContext - ALOAD 1 - LDC 4 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - ALOAD 1 - LDC 5 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callGetProperty (Ljava/lang/Object;)Ljava/lang/Object; (itf) ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callConstructor (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (itf) - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; - CHECKCAST org/spockframework/runtime/model/BlockInfo - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 @@ -140,23 +110,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov LDC Lorg/spockframework/runtime/SpecificationContext;.class INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; CHECKCAST org/spockframework/runtime/SpecificationContext - ALOAD 1 - LDC 6 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - ALOAD 1 - LDC 7 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callGetProperty (Ljava/lang/Object;)Ljava/lang/Object; (itf) - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callConstructor (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (itf) - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; - CHECKCAST org/spockframework/runtime/model/BlockInfo - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_1 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 @@ -207,23 +162,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov LDC Lorg/spockframework/runtime/SpecificationContext;.class INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; CHECKCAST org/spockframework/runtime/SpecificationContext - ALOAD 1 - LDC 8 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - ALOAD 1 - LDC 9 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callGetProperty (Ljava/lang/Object;)Ljava/lang/Object; (itf) - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callConstructor (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (itf) - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; - CHECKCAST org/spockframework/runtime/model/BlockInfo - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_1 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 @@ -231,29 +171,14 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov LDC Lorg/spockframework/runtime/SpecificationContext;.class INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; CHECKCAST org/spockframework/runtime/SpecificationContext - ALOAD 1 - LDC 10 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - ALOAD 1 - LDC 11 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callGetProperty (Ljava/lang/Object;)Ljava/lang/Object; (itf) - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callConstructor (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (itf) - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; - CHECKCAST org/spockframework/runtime/model/BlockInfo - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_2 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP L17 LINENUMBER 8 L17 ALOAD 1 - LDC 12 + LDC 2 AALOAD ALOAD 0 ACONST_NULL @@ -266,23 +191,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov LDC Lorg/spockframework/runtime/SpecificationContext;.class INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; CHECKCAST org/spockframework/runtime/SpecificationContext - ALOAD 1 - LDC 13 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - ALOAD 1 - LDC 14 - AALOAD - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callGetProperty (Ljava/lang/Object;)Ljava/lang/Object; (itf) - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEINTERFACE org/codehaus/groovy/runtime/callsite/CallSite.callConstructor (Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; (itf) - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.castToType (Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object; - CHECKCAST org/spockframework/runtime/model/BlockInfo - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_2 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____4.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____4.groovy index a6d0ee105b..32599b20df 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____4.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/Primitive_types_are_used_in_AST_transformation_Groovy____4.groovy @@ -60,33 +60,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEDYNAMIC getProperty(Ljava/lang/Class;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "EXPECT", - 0 - ] ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEDYNAMIC init(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/List;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "", - 0 - ] - INVOKEDYNAMIC cast(Ljava/lang/Object;)Lorg/spockframework/runtime/model/BlockInfo; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "()", - 0 - ] - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP L0 @@ -145,33 +120,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEDYNAMIC getProperty(Ljava/lang/Class;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "EXPECT", - 0 - ] ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEDYNAMIC init(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/List;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "", - 0 - ] - INVOKEDYNAMIC cast(Ljava/lang/Object;)Lorg/spockframework/runtime/model/BlockInfo; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "()", - 0 - ] - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 @@ -183,33 +133,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEDYNAMIC getProperty(Ljava/lang/Class;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "WHEN", - 0 - ] - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEDYNAMIC init(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/List;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "", - 0 - ] - INVOKEDYNAMIC cast(Ljava/lang/Object;)Lorg/spockframework/runtime/model/BlockInfo; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "()", - 0 - ] - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_1 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 @@ -269,33 +194,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEDYNAMIC getProperty(Ljava/lang/Class;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "WHEN", - 0 - ] - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEDYNAMIC init(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/List;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "", - 0 - ] - INVOKEDYNAMIC cast(Ljava/lang/Object;)Lorg/spockframework/runtime/model/BlockInfo; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "()", - 0 - ] - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_1 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 @@ -307,33 +207,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEDYNAMIC getProperty(Ljava/lang/Class;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "THEN", - 0 - ] - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEDYNAMIC init(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/List;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "", - 0 - ] - INVOKEDYNAMIC cast(Ljava/lang/Object;)Lorg/spockframework/runtime/model/BlockInfo; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "()", - 0 - ] - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_2 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callEnterBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP L17 @@ -359,33 +234,8 @@ public class apackage/TestSpec extends spock/lang/Specification implements groov "()", 0 ] - LDC Lorg/spockframework/runtime/model/BlockInfo;.class - LDC Lorg/spockframework/runtime/model/BlockKind;.class - INVOKEDYNAMIC getProperty(Ljava/lang/Class;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "THEN", - 0 - ] - ICONST_0 - ANEWARRAY java/lang/Object - INVOKESTATIC org/codehaus/groovy/runtime/ScriptBytecodeAdapter.createList ([Ljava/lang/Object;)Ljava/util/List; - INVOKEDYNAMIC init(Ljava/lang/Class;Ljava/lang/Object;Ljava/util/List;)Ljava/lang/Object; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "", - 0 - ] - INVOKEDYNAMIC cast(Ljava/lang/Object;)Lorg/spockframework/runtime/model/BlockInfo; [ - // handle kind 0x6 : INVOKESTATIC - org/codehaus/groovy/vmplugin/v8/IndyInterface.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;I)Ljava/lang/invoke/CallSite; - // arguments: - "()", - 0 - ] - INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;Lorg/spockframework/runtime/model/BlockInfo;)V + ICONST_2 + INVOKESTATIC org/spockframework/runtime/SpockRuntime.callExitBlock (Lorg/spockframework/runtime/SpecificationContext;I)V ACONST_NULL POP ALOAD 0 diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy index f4da13325a..81d1ef8aa8 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything.groovy @@ -7,9 +7,9 @@ public class apackage.ASpec extends spock.lang.Specification { @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = [])], parameterNames = []) public void $spock_feature_0_0() { - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object nothing = null - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy index 64e22a94fe..e0945eb56a 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_can_render_everything__Groovy_4_0_2__.groovy @@ -7,9 +7,9 @@ public class apackage.ASpec extends spock.lang.Specification implements groovy.l @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = [])], parameterNames = []) public void $spock_feature_0_0() { - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object nothing = null - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy index a56812945e..872fb00ade 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceFeatureBody_renders_only_methods_and_its_annotation_by_default.groovy @@ -6,9 +6,9 @@ class ASpec extends Specification { /*--------- tag::snapshot[] ---------*/ @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = [])], parameterNames = []) public void $spock_feature_0_0() { - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object nothing = null - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy index 9762b7dc12..f15995b174 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/astToSourceSpecBody_renders_only_methods__fields__properties__object_initializers_and_their_annotation_by_default.groovy @@ -12,9 +12,9 @@ private java.lang.Object $spock_initializeFields() { @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 3, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = [])], parameterNames = []) public void $spock_feature_0_0() { - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object nothing = null - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy new file mode 100644 index 0000000000..d93d268e55 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_GString_labels.groovy @@ -0,0 +1,40 @@ +package aPackage +import spock.lang.* + +class ASpec extends Specification { + def "aFeature"() { +/*--------- tag::snapshot[] ---------*/ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = []), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = []), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.WHEN, texts = []), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.THEN, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() + java.lang.Integer idx = 0 + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) + "given ${( idx )++}" + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), '\"expect \${idx++}\"', 3, 13, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), "${$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), ( idx )++)}expect ")) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, '\"expect \${idx++}\"', 3, 13, null, $spock_condition_throwable)} + finally { + } + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 2) + "when ${( idx )++}" + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 2) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 3) + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), '\"then \${idx++}\"', 5, 11, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), "${$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), ( idx )++)}then ")) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, '\"then \${idx++}\"', 5, 11, null, $spock_condition_throwable)} + finally { + } + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 3) + this.getSpecificationContext().getMockController().leaveScope() +} +/*--------- end::snapshot[] ---------*/ + } +} diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy new file mode 100644 index 0000000000..b4ce663bde --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_empty_labels.groovy @@ -0,0 +1,50 @@ +package aPackage +import spock.lang.* + +class ASpec extends Specification { + def "aFeature"() { +/*--------- tag::snapshot[] ---------*/ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = ['']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = ['']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.WHEN, texts = ['']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.THEN, texts = ['']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.CLEANUP, texts = ['']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.WHERE, texts = ['', '']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.FILTER, texts = [''])], parameterNames = []) +public void $spock_feature_0_0() { + java.lang.Throwable $spock_feature_throwable + try { + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 2) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 2) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 3) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 3) + } + catch (java.lang.Throwable $spock_tmp_throwable) { + $spock_feature_throwable = $spock_tmp_throwable + throw $spock_tmp_throwable + } + finally { + org.spockframework.runtime.model.BlockInfo $spock_failedBlock = null + try { + if ( $spock_feature_throwable != null) { + $spock_failedBlock = this.getSpecificationContext().getCurrentBlock() + } + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 4) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 4) + } + catch (java.lang.Throwable $spock_tmp_throwable) { + if ( $spock_feature_throwable != null) { + $spock_feature_throwable.addSuppressed($spock_tmp_throwable) + } else { + throw $spock_tmp_throwable + } + } + finally { + if ( $spock_feature_throwable != null) { + ((org.spockframework.runtime.SpecificationContext) this.getSpecificationContext()).setCurrentBlock($spock_failedBlock) + } + } + } + this.getSpecificationContext().getMockController().leaveScope() +} +/*--------- end::snapshot[] ---------*/ + } +} diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy new file mode 100644 index 0000000000..a4997557a9 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/BlocksAst/all_observable_blocks_with_labels_and_blocks.groovy @@ -0,0 +1,52 @@ +package aPackage +import spock.lang.* + +class ASpec extends Specification { + def "aFeature"() { +/*--------- tag::snapshot[] ---------*/ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = ['given', 'and given']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = ['expect', 'and expect']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.WHEN, texts = ['when', 'and when']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.THEN, texts = ['then', 'and then']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.THEN, texts = ['then2', 'and then2']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.CLEANUP, texts = ['cleanup', 'and cleanup']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.WHERE, texts = ['where', 'combine']), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.FILTER, texts = ['only one execution'])], parameterNames = []) +public void $spock_feature_0_0() { + java.lang.Throwable $spock_feature_throwable + try { + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 2) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 2) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 3) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 3) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 4) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 4) + } + catch (java.lang.Throwable $spock_tmp_throwable) { + $spock_feature_throwable = $spock_tmp_throwable + throw $spock_tmp_throwable + } + finally { + org.spockframework.runtime.model.BlockInfo $spock_failedBlock = null + try { + if ( $spock_feature_throwable != null) { + $spock_failedBlock = this.getSpecificationContext().getCurrentBlock() + } + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 5) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 5) + } + catch (java.lang.Throwable $spock_tmp_throwable) { + if ( $spock_feature_throwable != null) { + $spock_feature_throwable.addSuppressed($spock_tmp_throwable) + } else { + throw $spock_tmp_throwable + } + } + finally { + if ( $spock_feature_throwable != null) { + ((org.spockframework.runtime.SpecificationContext) this.getSpecificationContext()).setCurrentBlock($spock_failedBlock) + } + } + } + this.getSpecificationContext().getMockController().leaveScope() +} +/*--------- end::snapshot[] ---------*/ + } +} diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy index 986dc656ba..99460b34f4 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference.groovy @@ -13,10 +13,10 @@ public void $spock_feature_0_0() { java.lang.Object foobar java.lang.Throwable $spock_feature_throwable try { - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) foobar = this.foobar() - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) try { org.spockframework.runtime.SpockRuntime.verifyMethodCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'println(foobar)', 6, 3, null, this, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), 'println'), new java.lang.Object[]{$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), foobar)}, $spock_valueRecorder.realizeNas(4, false), false, 3) } @@ -24,7 +24,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'println(foobar)', 6, 3, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) } catch (java.lang.Throwable $spock_tmp_throwable) { $spock_feature_throwable = $spock_tmp_throwable @@ -36,9 +36,9 @@ public void $spock_feature_0_0() { if ( $spock_feature_throwable != null) { $spock_failedBlock = this.getSpecificationContext().getCurrentBlock() } - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.CLEANUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 2) foobar.size() - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.CLEANUP, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 2) } catch (java.lang.Throwable $spock_tmp_throwable) { if ( $spock_feature_throwable != null) { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy index 7c20cce30e..1ca7fb969e 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/CleanupBlocksAstSpec/cleanup_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy @@ -13,10 +13,10 @@ public void $spock_feature_0_0() { def (java.lang.Object foobar, java.lang.Object b) = [null, null] java.lang.Throwable $spock_feature_throwable try { - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) (foobar, b) = this.foobar() - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) try { org.spockframework.runtime.SpockRuntime.verifyMethodCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'println(foobar)', 6, 3, null, this, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), 'println'), new java.lang.Object[]{$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), foobar)}, $spock_valueRecorder.realizeNas(4, false), false, 3) } @@ -24,7 +24,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'println(foobar)', 6, 3, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) } catch (java.lang.Throwable $spock_tmp_throwable) { $spock_feature_throwable = $spock_tmp_throwable @@ -36,9 +36,9 @@ public void $spock_feature_0_0() { if ( $spock_feature_throwable != null) { $spock_failedBlock = this.getSpecificationContext().getCurrentBlock() } - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.CLEANUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 2) foobar.size() - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.CLEANUP, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 2) } catch (java.lang.Throwable $spock_tmp_throwable) { if ( $spock_feature_throwable != null) { diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy index 294105cf5e..84e95ba26c 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/multi_parameterization.groovy @@ -8,7 +8,7 @@ class ASpec extends Specification { public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'a == b', 1, 83, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), a) == $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), b))) } @@ -16,7 +16,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'a == b', 1, 83, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy index f4529d9ffd..8fbcbc5853 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/nested_multi_parameterization.groovy @@ -8,7 +8,7 @@ class ASpec extends Specification { public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'a == b', 1, 83, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), a) == $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), b))) } @@ -16,7 +16,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'a == b', 1, 83, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy index 0b05b88f80..18169b2e81 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[0].groovy @@ -7,7 +7,7 @@ class ASpec extends Specification { public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang.Object c) { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'true', 2, 7, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), true)) } @@ -15,7 +15,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'true', 2, 7, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy index 0b05b88f80..18169b2e81 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[1].groovy @@ -7,7 +7,7 @@ class ASpec extends Specification { public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang.Object c) { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'true', 2, 7, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), true)) } @@ -15,7 +15,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'true', 2, 7, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy index 0b05b88f80..18169b2e81 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/data_tables_with__separators_can_be_combined-[2].groovy @@ -7,7 +7,7 @@ class ASpec extends Specification { public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang.Object c) { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'true', 2, 7, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), true)) } @@ -15,7 +15,7 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b, java.lang org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'true', 2, 7, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy index 2e54448fc6..b87d83b4cf 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataTablesAstSpec/filter_block_becomes_its_own_method.groovy @@ -7,7 +7,7 @@ class ASpec extends Specification { public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'true', 2, 7, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), true)) } @@ -15,9 +15,9 @@ public void $spock_feature_0_0(java.lang.Object a, java.lang.Object b) { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'true', 2, 7, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.FILTER, [])) - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.FILTER, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 2) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 2) this.getSpecificationContext().getMockController().leaveScope() } diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy index 0c3335011d..16faae41cb 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsAsSet_is_transformed_correctly.groovy @@ -8,10 +8,10 @@ class ASpec extends Specification { public void $spock_feature_0_0() { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object x = [1] - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) try { org.spockframework.runtime.SpockRuntime.verifyMethodCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'x =~ [1]', 4, 9, null, org.spockframework.runtime.SpockRuntime, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), 'matchCollectionsAsSet'), new java.lang.Object[]{$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), x), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(3), [$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), 1)])}, $spock_valueRecorder.realizeNas(6, false), false, 5) } @@ -19,7 +19,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'x =~ [1]', 4, 9, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy index fe8a68a227..d925e60e44 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/collection_condition_matchCollectionsInAnyOrder_is_transformed_correctly.groovy @@ -8,10 +8,10 @@ class ASpec extends Specification { public void $spock_feature_0_0() { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object x = [1] - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) try { org.spockframework.runtime.SpockRuntime.verifyMethodCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'x ==~ [1]', 4, 9, null, org.spockframework.runtime.SpockRuntime, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), 'matchCollectionsInAnyOrder'), new java.lang.Object[]{$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), x), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(3), [$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), 1)])}, $spock_valueRecorder.realizeNas(6, false), false, 5) } @@ -19,7 +19,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'x ==~ [1]', 4, 9, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy index dc34962863..8668795cda 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_find_conditions_are_transformed_correctly.groovy @@ -8,10 +8,10 @@ class ASpec extends Specification { public void $spock_feature_0_0() { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object x = '[1]' - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'x =~ /\\d/', 4, 9, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), org.spockframework.runtime.SpockRuntime.matchCollectionsAsSet($spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), x), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), '\\d')))) } @@ -19,7 +19,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'x =~ /\\d/', 4, 9, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy index 9e5830c739..70dfef39f8 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/CollectionConditionAstSpec/regex_match_conditions_are_transformed_correctly.groovy @@ -8,10 +8,10 @@ class ASpec extends Specification { public void $spock_feature_0_0() { org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE org.spockframework.runtime.ValueRecorder $spock_valueRecorder = new org.spockframework.runtime.ValueRecorder() - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.lang.Object x = 'a1b' - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) try { org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'x ==~ /a\\db/', 4, 9, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), org.spockframework.runtime.SpockRuntime.matchCollectionsInAnyOrder($spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), x), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), 'a\\db')))) } @@ -19,7 +19,7 @@ public void $spock_feature_0_0() { org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'x ==~ /a\\db/', 4, 9, null, $spock_condition_throwable)} finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.EXPECT, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy index 0f5d72bec5..aae2ea5cf1 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference.groovy @@ -9,7 +9,7 @@ public java.lang.Object foobar() { public void $spock_feature_0_0() { java.lang.Object foobar - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().setThrownException(null) try { foobar = this.foobar() @@ -19,10 +19,10 @@ public void $spock_feature_0_0() { } finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) this.thrownImpl(null, null, java.lang.IllegalStateException) - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy index ca410aeb71..659981a807 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ExceptionConditionsAstSpec/thrown_rewrite_keeps_correct_method_reference_for_multi_assignments.groovy @@ -9,7 +9,7 @@ public java.lang.Object foobar() { public void $spock_feature_0_0() { def (java.lang.Object foobar, java.lang.Object b) = [null, null] - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) this.getSpecificationContext().setThrownException(null) try { (foobar, b) = this.foobar() @@ -19,10 +19,10 @@ public void $spock_feature_0_0() { } finally { } - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) this.thrownImpl(null, null, java.lang.IllegalStateException) - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/ diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy index 5cbd1b850d..aed9a88605 100644 --- a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/mock/MocksAstSpec/simple_interaction.groovy @@ -6,17 +6,17 @@ class ASpec extends Specification { /*--------- tag::snapshot[] ---------*/ @org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.SETUP, texts = []), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.WHEN, texts = []), @org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.THEN, texts = [])], parameterNames = []) public void $spock_feature_0_0() { - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 0) java.util.List list = this.MockImpl('list', java.util.List) this.getSpecificationContext().getMockController().enterScope() this.getSpecificationContext().getMockController().addInteraction(new org.spockframework.mock.runtime.InteractionBuilder(8, 5, '1 * list.add(1)').setFixedCount(1).addEqualTarget(list).addEqualMethodName('add').setArgListKind(true, false).addEqualArg(1).build()) - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.SETUP, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 0) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 1) list.add(1) - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.WHEN, [])) - org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 1) + org.spockframework.runtime.SpockRuntime.callEnterBlock(this.getSpecificationContext(), 2) this.getSpecificationContext().getMockController().leaveScope() - org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), new org.spockframework.runtime.model.BlockInfo(org.spockframework.runtime.model.BlockKind.THEN, [])) + org.spockframework.runtime.SpockRuntime.callExitBlock(this.getSpecificationContext(), 2) this.getSpecificationContext().getMockController().leaveScope() } /*--------- end::snapshot[] ---------*/