diff --git a/spock-core/src/main/java/org/spockframework/compiler/ConditionRewriter.java b/spock-core/src/main/java/org/spockframework/compiler/ConditionRewriter.java index 0d61458b95..6bfad87439 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/ConditionRewriter.java +++ b/spock-core/src/main/java/org/spockframework/compiler/ConditionRewriter.java @@ -41,6 +41,7 @@ import static java.util.Collections.singletonList; import static org.spockframework.compiler.AstUtil.createDirectMethodCall; import static org.spockframework.compiler.AstUtil.primitiveConstExpression; +import static org.spockframework.compiler.SpecialMethodCall.checkIsConditionMethodCall; // NOTE: currently some conversions reference old expression objects rather than copying them; // this can potentially lead to aliasing problems (e.g. for Condition.originalExpression) @@ -641,8 +642,7 @@ private Statement rewriteCondition(Expression expr, Expression message, boolean // method conditions with spread operator are not lifted because MOP doesn't support spreading if (expr instanceof MethodCallExpression && !((MethodCallExpression) expr).isSpreadSafe()) { MethodCallExpression methodCallExpression = (MethodCallExpression)expr; - String methodName = AstUtil.getMethodName(methodCallExpression); - if ((Identifiers.CONDITION_METHODS.contains(methodName))) { + if (checkIsConditionMethodCall(methodCallExpression)) { return surroundSpecialTryCatch(expr); } return rewriteMethodCondition(methodCallExpression, message, explicit, optOut); diff --git a/spock-core/src/main/java/org/spockframework/compiler/DeepBlockRewriter.java b/spock-core/src/main/java/org/spockframework/compiler/DeepBlockRewriter.java index 1d66724cf8..06e08cc8ca 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/DeepBlockRewriter.java +++ b/spock-core/src/main/java/org/spockframework/compiler/DeepBlockRewriter.java @@ -204,12 +204,17 @@ private boolean handleImplicitCondition(ExpressionStatement stat) { checkIsValidImplicitCondition(stat, resources.getErrorReporter()); - String methodName = AstUtil.getMethodName(stat.getExpression()); - boolean isConditionMethodCall = Identifiers.CONDITION_METHODS.contains(methodName); + boolean isConditionMethodCall; + if (stat.getExpression() instanceof MethodCallExpression) { + isConditionMethodCall = SpecialMethodCall.checkIsConditionMethodCall(((MethodCallExpression) stat.getExpression())); + } else { + isConditionMethodCall = false; + } if (isConditionMethodCall) { groupConditionFound = currSpecialMethodCall.isGroupConditionBlock(); - } else { + } + if (!isConditionMethodCall || currSpecialMethodCall.isConditionMethodCall() || currSpecialMethodCall.isGroupConditionBlock()) { conditionFound(); } diff --git a/spock-core/src/main/java/org/spockframework/compiler/SpecialMethodCall.java b/spock-core/src/main/java/org/spockframework/compiler/SpecialMethodCall.java index 7755a2c3a5..d2fc0c7c98 100644 --- a/spock-core/src/main/java/org/spockframework/compiler/SpecialMethodCall.java +++ b/spock-core/src/main/java/org/spockframework/compiler/SpecialMethodCall.java @@ -269,6 +269,11 @@ public String toString() { methodName, inferredName, inferredType, methodCallExpr, closureExpr, conditionBlock); } + static boolean checkIsConditionMethodCall(MethodCallExpression expr) { + if (!AstUtil.isThisOrSuperExpression(expr.getObjectExpression())) return false; + return Identifiers.CONDITION_METHODS.contains(expr.getMethodAsString()); + } + private static boolean checkIsBuiltInMethodCall(MethodCallExpression expr) { if (!AstUtil.isThisOrSuperExpression(expr.getObjectExpression())) return false; return Identifiers.BUILT_IN_METHODS.contains(expr.getMethodAsString()); diff --git a/spock-specs/src/test/groovy/org/spockframework/smoke/WithBlockFailingConditions.groovy b/spock-specs/src/test/groovy/org/spockframework/smoke/WithBlockFailingConditions.groovy index 675e2d00ae..e9eb925a78 100644 --- a/spock-specs/src/test/groovy/org/spockframework/smoke/WithBlockFailingConditions.groovy +++ b/spock-specs/src/test/groovy/org/spockframework/smoke/WithBlockFailingConditions.groovy @@ -14,10 +14,11 @@ package org.spockframework.smoke +import org.spockframework.EmbeddedSpecification import org.spockframework.runtime.* import spock.lang.* -class WithBlockFailingConditions extends Specification { +class WithBlockFailingConditions extends EmbeddedSpecification { @FailsWith(ConditionNotSatisfiedError) def "basic usage"() { def list = [1, 2] @@ -155,4 +156,146 @@ class WithBlockFailingConditions extends Specification { size() == 3 } } + + @FailsWith(ConditionNotSatisfiedError) + def "GDK method that looks like built-in method as implicit condition"() { + expect: + null.with { + false + } + } + + @FailsWith(ConditionNotSatisfiedError) + def "GDK method that looks like built-in method as explicit condition"() { + expect: + assert null.with { + false + } + } + + def "condition method #conditionMethod within condition method #conditionMethod"() { + when: + runner.runFeatureBody(""" +expect: +$conditionMethod(['']) { + $conditionMethod(['']) { + false + } +} +""") + + then: + thrown(expectedException) + + where: + conditionMethod || expectedException + 'with' || ConditionNotSatisfiedError + 'verifyAll' || ConditionNotSatisfiedError + 'verifyEach' || SpockAssertionError + } + + def "condition method #conditionMethod within condition method #conditionMethod with exception"() { + when: + runner.runFeatureBody(""" +expect: +$conditionMethod(['']) { + $conditionMethod(['']) { + true + throw new Exception('foo') + } +} +""") + + then: + def exception = thrown(expectedException) + exception.message."${expectedException == Exception ? 'equals' : 'contains'}"('foo') + + where: + conditionMethod || expectedException + 'with' || Exception + 'verifyAll' || Exception + 'verifyEach' || SpockAssertionError + } + + def "condition method #conditionMethod within condition method #conditionMethod with only exception"() { + when: + runner.runFeatureBody(""" +expect: +$conditionMethod(['']) { + $conditionMethod(['']) { + throw new Exception('foo') + } +} +""") + + then: + def exception = thrown(expectedException) + exception.message."${expectedException == Exception ? 'equals' : 'contains'}"('foo') + + where: + conditionMethod || expectedException + 'with' || Exception + 'verifyAll' || Exception + 'verifyEach' || SpockAssertionError + } + + def "condition method #conditionMethod"() { + when: + runner.runFeatureBody(""" +expect: +$conditionMethod(['']) { + false +} +""") + + then: + thrown(expectedException) + + where: + conditionMethod || expectedException + 'with' || ConditionNotSatisfiedError + 'verifyAll' || ConditionNotSatisfiedError + 'verifyEach' || SpockAssertionError + } + + def "condition method #conditionMethod with exception"() { + when: + runner.runFeatureBody(""" +expect: +$conditionMethod(['']) { + true + throw new Exception('foo') +} +""") + + then: + def exception = thrown(expectedException) + exception.message."${expectedException == Exception ? 'equals' : 'contains'}"('foo') + + where: + conditionMethod || expectedException + 'with' || Exception + 'verifyAll' || Exception + 'verifyEach' || SpockAssertionError + } + + def "condition method #conditionMethod with only exception"() { + when: + runner.runFeatureBody(""" +expect: +$conditionMethod(['']) { + throw new Exception('foo') +} +""") + + then: + def exception = thrown(expectedException) + exception.message."${expectedException == Exception ? 'equals' : 'contains'}"('foo') + + where: + conditionMethod || expectedException + 'with' || Exception + 'verifyAll' || Exception + 'verifyEach' || SpockAssertionError + } } diff --git a/spock-specs/src/test/groovy/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec.groovy b/spock-specs/src/test/groovy/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec.groovy new file mode 100644 index 0000000000..37928ef491 --- /dev/null +++ b/spock-specs/src/test/groovy/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec.groovy @@ -0,0 +1,180 @@ +/* + * 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.condition + + +import org.spockframework.EmbeddedSpecification +import org.spockframework.specs.extension.SpockSnapshotter +import spock.lang.Snapshot + +class ConditionMethodsAstSpec extends EmbeddedSpecification { + @Snapshot(extension = 'groovy') + SpockSnapshotter snapshotter + + def "GDK method that looks like built-in method as implicit condition"() { + when: + def result = compiler.transpileFeatureBody(''' +expect: +null.with { + false +} +''') + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + } + + def "GDK method that looks like built-in method as explicit condition"() { + when: + def result = compiler.transpileFeatureBody(''' +expect: +assert null.with { + false +} +''') + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + } + + def "condition method #conditionMethod within condition method #conditionMethod"() { + when: + def result = compiler.transpileFeatureBody(""" +expect: +$conditionMethod(['']) { + $conditionMethod(['']) { + false + } +} +""") + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + + where: + conditionMethod << [ + 'with', + 'verifyAll', + 'verifyEach' + ] + } + + def "condition method #conditionMethod within condition method #conditionMethod with exception"() { + when: + def result = compiler.transpileFeatureBody(""" +expect: +$conditionMethod(['']) { + $conditionMethod(['']) { + true + throw new Exception('foo') + } +} +""") + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + + where: + conditionMethod << [ + 'with', + 'verifyAll', + 'verifyEach' + ] + } + + def "condition method #conditionMethod within condition method #conditionMethod with only exception"() { + when: + def result = compiler.transpileFeatureBody(""" +expect: +$conditionMethod(['']) { + $conditionMethod(['']) { + throw new Exception('foo') + } +} +""") + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + + where: + conditionMethod << [ + 'with', + 'verifyAll', + 'verifyEach' + ] + } + + def "condition method #conditionMethod"() { + when: + def result = compiler.transpileFeatureBody(""" +expect: +$conditionMethod(['']) { + false +} +""") + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + + where: + conditionMethod << [ + 'with', + 'verifyAll', + 'verifyEach' + ] + } + + def "condition method #conditionMethod with exception"() { + when: + def result = compiler.transpileFeatureBody(""" +expect: +$conditionMethod(['']) { + true + throw new Exception('foo') +} +""") + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + + where: + conditionMethod << [ + 'with', + 'verifyAll', + 'verifyEach' + ] + } + + def "condition method #conditionMethod with only exception"() { + when: + def result = compiler.transpileFeatureBody(""" +expect: +$conditionMethod(['']) { + throw new Exception('foo') +} +""") + + then: + snapshotter.assertThat(result.source).matchesSnapshot() + + where: + conditionMethod << [ + 'with', + 'verifyAll', + 'verifyEach' + ] + } +} diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy new file mode 100644 index 0000000000..e14d4ce304 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy @@ -0,0 +1,17 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, 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() + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + try { + org.spockframework.runtime.SpockRuntime.verifyMethodCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'null.with {\n false\n}', 2, 8, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), null), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), 'with'), new java.lang.Object[]{$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), { -> + false + })}, $spock_valueRecorder.realizeNas(5, false), true, 4) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'null.with {\n false\n}', 2, 8, null, $spock_condition_throwable)} + finally { + } + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy new file mode 100644 index 0000000000..ab3d77982b --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy @@ -0,0 +1,17 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, 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() + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + try { + org.spockframework.runtime.SpockRuntime.verifyMethodCondition($spock_errorCollector, $spock_valueRecorder.reset(), 'null.with {\n false\n}', 2, 1, null, $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(0), null), $spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(1), 'with'), new java.lang.Object[]{$spock_valueRecorder.record($spock_valueRecorder.startRecordingValue(2), { -> + false + })}, $spock_valueRecorder.realizeNas(5, false), false, 4) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder, 'null.with {\n false\n}', 2, 1, null, $spock_condition_throwable)} + finally { + } + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy new file mode 100644 index 0000000000..c97c9d6e24 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy @@ -0,0 +1,17 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.with([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder1.reset(), 'false', 3, 3, null, $spock_valueRecorder1.record($spock_valueRecorder1.startRecordingValue(0), false)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder1, 'false', 3, 3, null, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy new file mode 100644 index 0000000000..31f7332824 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy @@ -0,0 +1,21 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyAll([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + org.spockframework.runtime.ErrorCollector $spock_errorCollector1 = new org.spockframework.runtime.ErrorCollector() + try { + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector1, $spock_valueRecorder1.reset(), 'false', 3, 3, null, $spock_valueRecorder1.record($spock_valueRecorder1.startRecordingValue(0), false)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector1, $spock_valueRecorder1, 'false', 3, 3, null, $spock_condition_throwable)} + finally { + } + } + finally { + $spock_errorCollector1.validateCollectedErrors()} + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy new file mode 100644 index 0000000000..52f29ac909 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy @@ -0,0 +1,17 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyEach([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder1.reset(), 'false', 3, 3, null, $spock_valueRecorder1.record($spock_valueRecorder1.startRecordingValue(0), false)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder1, 'false', 3, 3, null, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy new file mode 100644 index 0000000000..3dfadc55b6 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy @@ -0,0 +1,18 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.with([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder1.reset(), 'true', 3, 3, null, $spock_valueRecorder1.record($spock_valueRecorder1.startRecordingValue(0), true)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder1, 'true', 3, 3, null, $spock_condition_throwable)} + finally { + } + throw new java.lang.Exception('foo') + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy new file mode 100644 index 0000000000..ee29dea335 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy @@ -0,0 +1,22 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyAll([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + org.spockframework.runtime.ErrorCollector $spock_errorCollector1 = new org.spockframework.runtime.ErrorCollector() + try { + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector1, $spock_valueRecorder1.reset(), 'true', 3, 3, null, $spock_valueRecorder1.record($spock_valueRecorder1.startRecordingValue(0), true)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector1, $spock_valueRecorder1, 'true', 3, 3, null, $spock_condition_throwable)} + finally { + } + throw new java.lang.Exception('foo') + } + finally { + $spock_errorCollector1.validateCollectedErrors()} + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy new file mode 100644 index 0000000000..f28f80ce8b --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy @@ -0,0 +1,18 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyEach([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder1.reset(), 'true', 3, 3, null, $spock_valueRecorder1.record($spock_valueRecorder1.startRecordingValue(0), true)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder1, 'true', 3, 3, null, $spock_condition_throwable)} + finally { + } + throw new java.lang.Exception('foo') + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy new file mode 100644 index 0000000000..600a99145f --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[0].groovy @@ -0,0 +1,9 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.with([''], { -> + throw new java.lang.Exception('foo') + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy new file mode 100644 index 0000000000..022253fdd2 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[1].groovy @@ -0,0 +1,9 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyAll([''], { -> + throw new java.lang.Exception('foo') + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy new file mode 100644 index 0000000000..4ffd94652e --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_only_exception-[2].groovy @@ -0,0 +1,9 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyEach([''], { -> + throw new java.lang.Exception('foo') + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy new file mode 100644 index 0000000000..d97957c82b --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[0].groovy @@ -0,0 +1,26 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.with([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + this.with([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder2 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder2.reset(), 'false', 4, 5, null, $spock_valueRecorder2.record($spock_valueRecorder2.startRecordingValue(0), false)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder2, 'false', 4, 5, null, $spock_condition_throwable)} + finally { + } + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy new file mode 100644 index 0000000000..35791d6e7a --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[1].groovy @@ -0,0 +1,35 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyAll([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + org.spockframework.runtime.ErrorCollector $spock_errorCollector1 = new org.spockframework.runtime.ErrorCollector() + try { + try { + this.verifyAll([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder2 = new org.spockframework.runtime.ValueRecorder() + org.spockframework.runtime.ErrorCollector $spock_errorCollector2 = new org.spockframework.runtime.ErrorCollector() + try { + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector2, $spock_valueRecorder2.reset(), 'false', 4, 5, null, $spock_valueRecorder2.record($spock_valueRecorder2.startRecordingValue(0), false)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector2, $spock_valueRecorder2, 'false', 4, 5, null, $spock_condition_throwable)} + finally { + } + } + finally { + $spock_errorCollector2.validateCollectedErrors()} + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector1, $spock_condition_throwable)} + finally { + } + } + finally { + $spock_errorCollector1.validateCollectedErrors()} + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy new file mode 100644 index 0000000000..862c8f93f0 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod-[2].groovy @@ -0,0 +1,26 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyEach([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + this.verifyEach([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder2 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder2.reset(), 'false', 4, 5, null, $spock_valueRecorder2.record($spock_valueRecorder2.startRecordingValue(0), false)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder2, 'false', 4, 5, null, $spock_condition_throwable)} + finally { + } + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy new file mode 100644 index 0000000000..bb7f8920ad --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[0].groovy @@ -0,0 +1,27 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.with([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + this.with([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder2 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder2.reset(), 'true', 4, 5, null, $spock_valueRecorder2.record($spock_valueRecorder2.startRecordingValue(0), true)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder2, 'true', 4, 5, null, $spock_condition_throwable)} + finally { + } + throw new java.lang.Exception('foo') + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy new file mode 100644 index 0000000000..7d541a6c46 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[1].groovy @@ -0,0 +1,36 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyAll([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + org.spockframework.runtime.ErrorCollector $spock_errorCollector1 = new org.spockframework.runtime.ErrorCollector() + try { + try { + this.verifyAll([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder2 = new org.spockframework.runtime.ValueRecorder() + org.spockframework.runtime.ErrorCollector $spock_errorCollector2 = new org.spockframework.runtime.ErrorCollector() + try { + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector2, $spock_valueRecorder2.reset(), 'true', 4, 5, null, $spock_valueRecorder2.record($spock_valueRecorder2.startRecordingValue(0), true)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector2, $spock_valueRecorder2, 'true', 4, 5, null, $spock_condition_throwable)} + finally { + } + throw new java.lang.Exception('foo') + } + finally { + $spock_errorCollector2.validateCollectedErrors()} + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector1, $spock_condition_throwable)} + finally { + } + } + finally { + $spock_errorCollector1.validateCollectedErrors()} + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy new file mode 100644 index 0000000000..d9903c6e49 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_exception-[2].groovy @@ -0,0 +1,27 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyEach([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + this.verifyEach([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder2 = new org.spockframework.runtime.ValueRecorder() + try { + org.spockframework.runtime.SpockRuntime.verifyCondition($spock_errorCollector, $spock_valueRecorder2.reset(), 'true', 4, 5, null, $spock_valueRecorder2.record($spock_valueRecorder2.startRecordingValue(0), true)) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.conditionFailedWithException($spock_errorCollector, $spock_valueRecorder2, 'true', 4, 5, null, $spock_condition_throwable)} + finally { + } + throw new java.lang.Exception('foo') + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy new file mode 100644 index 0000000000..883aaf44f0 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[0].groovy @@ -0,0 +1,19 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.with([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + this.with([''], { -> + throw new java.lang.Exception('foo') + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy new file mode 100644 index 0000000000..363db57aa4 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[1].groovy @@ -0,0 +1,23 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyAll([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + org.spockframework.runtime.ErrorCollector $spock_errorCollector1 = new org.spockframework.runtime.ErrorCollector() + try { + try { + this.verifyAll([''], { -> + throw new java.lang.Exception('foo') + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector1, $spock_condition_throwable)} + finally { + } + } + finally { + $spock_errorCollector1.validateCollectedErrors()} + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file diff --git a/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy new file mode 100644 index 0000000000..4078772382 --- /dev/null +++ b/spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_within_condition_method__conditionMethod_with_only_exception-[2].groovy @@ -0,0 +1,19 @@ +@org.spockframework.runtime.model.FeatureMetadata(name = 'a feature', ordinal = 0, line = 1, blocks = [@org.spockframework.runtime.model.BlockMetadata(kind = org.spockframework.runtime.model.BlockKind.EXPECT, texts = [])], parameterNames = []) +public void $spock_feature_0_0() { + org.spockframework.runtime.ErrorCollector $spock_errorCollector = org.spockframework.runtime.ErrorRethrower.INSTANCE + org.spockframework.runtime.SpockRuntime.callBlockEntered(this, 0) + this.verifyEach([''], { -> + org.spockframework.runtime.ValueRecorder $spock_valueRecorder1 = new org.spockframework.runtime.ValueRecorder() + try { + this.verifyEach([''], { -> + throw new java.lang.Exception('foo') + }) + } + catch (java.lang.Throwable $spock_condition_throwable) { + org.spockframework.runtime.SpockRuntime.groupConditionFailedWithException($spock_errorCollector, $spock_condition_throwable)} + finally { + } + }) + org.spockframework.runtime.SpockRuntime.callBlockExited(this, 0) + this.getSpecificationContext().getMockController().leaveScope() +} \ No newline at end of file