Skip to content

Support final local variables in where-blocks (#138)#2370

Open
leonard84 wants to merge 14 commits into
spockframework:masterfrom
leonard84:where-block-variables
Open

Support final local variables in where-blocks (#138)#2370
leonard84 wants to merge 14 commits into
spockframework:masterfrom
leonard84:where-block-variables

Conversation

@leonard84

@leonard84 leonard84 commented Jun 6, 2026

Copy link
Copy Markdown
Member

Summary

Implements #138: final local variables in where: blocks, following the design discussed on the issue.

You can declare final locals at the start of a where: block as scoped helper values that are not turned into data variables / method parameters:

def "paths are normalized"() {
  expect:
  normalize(input) == expected

  where:
  final sep = File.separator

  input              | expected
  "a${sep}b"         | "a/b"
  "x${sep}y${sep}z"  | "x/y/z"
}

Semantics

  • final is the marker. final x = … declares a where-block variable; a bare x = … remains a derived data variable. Non-final declarations are a compile error pointing at final.
  • Leading only. Must be declared before any data variable / table / pipe; a later declaration is a compile error (so they can never reference data variables).
  • Evaluated once per feature and reused everywhere referenced — final fixture = new Fixture() is a single shared instance.
  • Scoped to the where-block. Visible to data tables, data pipes, derived data variables and the filter: block; not feature-method parameters and not visible in the feature body.
  • Access rules match data providers: may read @Shared/static fields, not instance fields.
  • Reserved-prefix guard: user variable names (where-block vars and data variables) may not start with $spock_.
  • A data variable may not reuse a where-block variable's name.

Implementation

The compiler collects the leading final declarations into a single generated …wherevars() method that returns their values as an Object[]. The runtime invokes it once per feature and passes the values into every data provider, the data processor, and the filter method as trailing parameters named after the user's variables (mirroring the existing previous-data-table-variable mechanism). No AST duplication; single evaluation.

Touched: WhereBlockRewriter, InternalIdentifiers, MethodKind, FeatureInfo, SpecInfoBuilder, IDataIterator, DataIteratorFactory.

Tests & docs

  • Behavior specs (WhereBlockVariables): data tables, data pipes, derived variables, single-evaluation across providers, cross-multiplication (combined:), filter:, @Shared access, not-visible-in-body.
  • Compile-error specs (InvalidWhereBlocks): non-final, misplaced, multiple assignment, reserved prefix, name collision, instance-field access.
  • AST snapshot tests (DataAstSpec): a focused case and a comprehensive one combining table + pipe + derived + combine + filter.
  • Docs section in data_driven_testing.adoc (with a tested example) and a release note.

Closes #138

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b23a7a01-0011-42cb-ac2a-5160eb0b8808

📥 Commits

Reviewing files that changed from the base of the PR and between 833222f and 7124dea.

📒 Files selected for processing (4)
  • docs/data_driven_testing.adoc
  • spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java
  • spock-core/src/main/java/org/spockframework/runtime/IDataIterator.java
  • spock-specs/src/test/groovy/org/spockframework/smoke/parameterization/InvalidWhereBlocks.groovy
✅ Files skipped from review due to trivial changes (1)
  • docs/data_driven_testing.adoc
🚧 Files skipped from review as they are similar to previous changes (1)
  • spock-core/src/main/java/org/spockframework/runtime/IDataIterator.java

📝 Walkthrough

Walkthrough

This PR adds support for declaring final local variables at the start of where: blocks: compiler collects/validates them, emits a synthetic where-variables method evaluated once per feature, threads values through data providers/processors/filters at runtime, and closes AutoCloseable values in LIFO order after the feature.

Changes

where-block local variables feature

Layer / File(s) Summary
Model contract and identifier helpers
spock-core/src/main/java/org/spockframework/runtime/model/MethodKind.java, spock-core/src/main/java/org/spockframework/util/InternalIdentifiers.java, spock-core/src/main/java/org/spockframework/runtime/IDataIterator.java
Adds WHERE_VARIABLES method kind, NO_WHERE_VARIABLE_VALUES constant with default getWhereVariableValues(), and getWhereVariablesName() helper.
Feature metadata discovery
spock-core/src/main/java/org/spockframework/runtime/SpecInfoBuilder.java, spock-core/src/main/java/org/spockframework/runtime/model/FeatureInfo.java
SpecInfoBuilder discovers synthetic where-variables methods; FeatureInfo stores and exposes whereVariablesMethod.
Compiler: collection and validation
spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java
Collect leading final where-block declarations, enforce placement and naming constraints, detect unsupported multiple-assignment wildcards, and add where-block-specific compile errors.
Compiler: code generation and threading
spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java
Generate synthetic where-variables method returning Object[], implement parameter concatenation, append where-variable parameters to generated data provider/processor/filter signatures, and add collision/reserved-name checks.
Runtime: evaluation and threading
spock-core/src/main/java/org/spockframework/runtime/DataIteratorFactory.java
Add appendArgs() helper; FeatureDataProviderIterator evaluates where-variables up-front, exposes getWhereVariableValues(), threads values into provider/processor/filter calls, and closes AutoCloseable entries in reverse declaration order (swallowing close errors).
Tests: compile-time validation
spock-specs/src/test/groovy/org/spockframework/smoke/parameterization/InvalidWhereBlocks.groovy
Adds multiple compilation-failure tests and one success case covering final-only, placement, multiple-assignment rules, wildcard restriction (Groovy 3+), reserved $spock_ prefix, instance-field access restriction, and name collisions.
Tests: runtime behavior
spock-specs/src/test/groovy/org/spockframework/smoke/parameterization/WhereBlockVariables.groovy
Comprehensive smoke tests for scoping, single evaluation/reuse, derived variables, combined providers, multiple-assignment variants, closure capture, data pipes, filter access, and AutoCloseable lifecycle semantics.
Tests: AST transformation
spock-specs/src/test/groovy/org/spockframework/smoke/ast/DataAstSpec.groovy, spock-specs/src/test/resources/snapshots/*
Snapshot tests showing generated where-variables supplier and updated providers/processors/filters for simple, multiple-assignment (versioned), and combined scenarios.
Integration and docs
spock-specs/src/test/groovy/org/spockframework/docs/datadriven/DataSpec.groovy, spock-specs/src/test/groovy/org/spockframework/runtime/StoreSpec.groovy, docs/data_driven_testing.adoc, docs/release_notes.adoc
Integration examples and release notes updated; detailed docs section added describing syntax, scoping, evaluation, AutoCloseable cleanup, and Groovy version constraints.

Sequence Diagram(s)

sequenceDiagram
  participant SpecInfoBuilder
  participant WhereBlockRewriter
  participant FeatureDataProviderIterator
  participant DataProcessorIterator
  participant IterationFilterIterator
  SpecInfoBuilder->>WhereBlockRewriter: discover/record where-block declarations
  WhereBlockRewriter->>SpecInfoBuilder: generate where-variables method name / methodInfo
  FeatureDataProviderIterator->>WhereBlockRewriter: invoke whereVariablesMethod (createWhereVariableValues)
  WhereBlockRewriter->>FeatureDataProviderIterator: return Object[] whereVariableValues
  FeatureDataProviderIterator->>DataProcessorIterator: append whereVariableValues to provider args
  DataProcessorIterator->>IterationFilterIterator: pass concatenated args including whereVariableValues
  FeatureDataProviderIterator->>FeatureDataProviderIterator: on close -> closeWhereVariables() (reverse order)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • AndreasTu

🐰 A rabbit's verse on where-block liberty:
Where-block variables declared final and free,
Evaluated once, reused with glee,
AutoCloseable cleanup in reverse refrain,
No instance fields, no $spock_ disdain,
A cleaner where-block, at last, hooray!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.91% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Support final local variables in where-blocks (#138)' clearly and concisely describes the main feature being implemented.
Description check ✅ Passed The PR description is comprehensive and well-related to the changeset, explaining the feature, semantics, implementation details, and test coverage.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #138: enables final local variable declarations in where-blocks [#138], scopes them to where-blocks, evaluates once per feature, enforces leading placement, applies access rules, adds reserved-prefix guards, prevents name collisions, and includes comprehensive tests and documentation.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing final local variables in where-blocks. The PR modifies compiler infrastructure (WhereBlockRewriter), runtime support (DataIteratorFactory, IDataIterator, SpecInfoBuilder), model classes (FeatureInfo, MethodKind, InternalIdentifiers), documentation, and tests—all aligned with the stated objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leonard84 leonard84 self-assigned this Jun 6, 2026
@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.28%. Comparing base (7313c19) to head (7124dea).

Files with missing lines Patch % Lines
...rg/spockframework/compiler/WhereBlockRewriter.java 96.66% 2 Missing and 1 partial ⚠️
...rg/spockframework/runtime/DataIteratorFactory.java 95.83% 1 Missing ⚠️
...java/org/spockframework/runtime/IDataIterator.java 50.00% 1 Missing ⚠️
.../org/spockframework/runtime/model/FeatureInfo.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2370      +/-   ##
============================================
+ Coverage     82.18%   82.28%   +0.10%     
- Complexity     4832     4870      +38     
============================================
  Files           473      474       +1     
  Lines         15051    15169     +118     
  Branches       1912     1932      +20     
============================================
+ Hits          12369    12482     +113     
- Misses         1991     1994       +3     
- Partials        691      693       +2     
Files with missing lines Coverage Δ
...va/org/spockframework/runtime/SpecInfoBuilder.java 99.28% <100.00%> (+0.02%) ⬆️
...a/org/spockframework/runtime/model/MethodKind.java 77.27% <100.00%> (+1.08%) ⬆️
...a/org/spockframework/util/InternalIdentifiers.java 93.33% <100.00%> (+0.47%) ⬆️
...rg/spockframework/runtime/DataIteratorFactory.java 79.77% <95.83%> (+0.78%) ⬆️
...java/org/spockframework/runtime/IDataIterator.java 50.00% <50.00%> (ø)
.../org/spockframework/runtime/model/FeatureInfo.java 90.67% <75.00%> (-0.56%) ⬇️
...rg/spockframework/compiler/WhereBlockRewriter.java 95.03% <96.66%> (+0.26%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leonard84 leonard84 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we support automatic cleanup for AutoCloseable types for where vars? Is there a good location to place a hook/register a cleanup?

Comment thread spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java Outdated
Comment thread spock-core/src/main/java/org/spockframework/runtime/IDataIterator.java Outdated
@leonard84

Copy link
Copy Markdown
Member Author

Can we support automatic cleanup for AutoCloseable types for where vars? Is there a good location to place a hook/register a cleanup?

Done. AutoCloseable where-block variables are now closed automatically once the feature finishes, in reverse declaration order; close failures are ignored (quiet). The hook is FeatureDataProviderIterator.close(), which already runs after all iterations of the feature complete (via the try-with-resources around the data iterator), so it was the natural place — it holds the computed where-variable values and fires exactly once per feature.

Effectively a where-block variable now behaves like a feature-local @Shared @AutoCleanup(quiet = true) field.

leonard84 added 13 commits June 7, 2026 15:40
…k#138)

The filter-block previously could not reference where-block variables: such
references compiled but failed at runtime with a MissingPropertyException.
Extend access so filter-blocks see where-block variables, consistent with
data tables, data pipes and derived data variables.

- WhereBlockRewriter: append the where-variable parameters to the filter
  method signature, like the provider and processor methods already do.
- DataIteratorFactory: propagate getWhereVariableValues() through the
  iterator chain and pass them when invoking the filter method.
- FeatureInfo: mark whereVariablesMethod @nullable for consistency with the
  neighbouring optional method fields.
- Document filter-block visibility and add a smoke test; regenerate the
  combined AST snapshot.
Allow 'final (a, b) = ...' tuple declarations for where-block variables,
in addition to single 'final x = ...'. Each target becomes its own
where-block variable; the declaration is emitted verbatim so Groovy
handles the destructuring and the existing name-driven machinery covers
the rest. Non-final tuples now report the regular must-be-final error.

The tuple syntax requires the Parrot parser (Groovy 3.0+), so the new
runtime, AST and docs tests are gated with @requires; the AST snapshot is
keyed by Groovy version since 5.0 renders the declaration differently.

Also address review feedback: return a shared empty-array constant from
IDataIterator.getWhereVariableValues(), and tighten the data-variable
collision assertion to check the full message.
Close where-block variables that implement AutoCloseable once the feature
has finished, in reverse declaration order. Cleanup is quiet: errors thrown
while closing are ignored. This hooks into FeatureDataProviderIterator.close(),
which already runs after all iterations of the feature complete.

A where-block variable thus behaves like a feature-local
'@shared @AutoCleanup(quiet = true)' field.
@leonard84 leonard84 force-pushed the where-block-variables branch from 10c209b to 833222f Compare June 7, 2026 13:40
@leonard84 leonard84 marked this pull request as ready for review June 7, 2026 13:40
@greptile-apps

greptile-apps Bot commented Jun 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR implements final local variables in where: blocks (issue #138). Where-block variables are declared at the top of the where: block with final, are evaluated once per feature, scoped to the where block, and automatically closed (LIFO) if they implement AutoCloseable.

  • Compiler (WhereBlockRewriter): collects leading final declarations into a generated …wherevars() method and appends the variable names as trailing parameters to every provider, processor, and filter method so that where-block expressions resolve to them naturally.
  • Runtime (DataIteratorFactory, IDataIterator): calls wherevars() once per feature, threads the resulting array into every provider/processor/filter invocation via appendArgs, and closes AutoCloseable values in reverse declaration order on feature teardown.
  • Tests and docs: comprehensive behaviour specs, compile-error specs, and three new AST snapshot tests; documentation section in data_driven_testing.adoc and a release note are included.

Confidence Score: 3/5

The feature is well-designed and broadly tested, but the multiple-assignment validation loop in the compiler leaves whereBlockVariableNames and whereBlockVariables in an inconsistent state when a later tuple target carries an invalid name, which can cause provider methods to be emitted with spurious parameters that have no backing wherevars method.

The single-variable path and the happy path for multiple assignment are solid. The inconsistency in collectMultipleAssignmentWhereBlockVariables — names appended to whereBlockVariableNames before all targets are validated, while the statement is never added to whereBlockVariables — means that on error recovery the generated provider/processor signatures include a parameter that the runtime can never supply, producing a confusing MissingMethodException as a secondary failure. This is the key area that needs attention before merging.

The validation loop in WhereBlockRewriter.collectMultipleAssignmentWhereBlockVariables (lines 226–248) is the primary concern. DataIteratorFactory.closeWhereVariables (the resource-leak on partial initialization) and the mutable NO_WHERE_VARIABLE_VALUES constant in IDataIterator are secondary observations.

Important Files Changed

Filename Overview
spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java Core compilation transform: collects leading final declarations, generates wherevars() method and appends where-variable parameters to every provider/processor/filter method. Has a partial-state bug in collectMultipleAssignmentWhereBlockVariables when a later tuple target fails validation after earlier names were already appended to whereBlockVariableNames.
spock-core/src/main/java/org/spockframework/runtime/DataIteratorFactory.java Runtime support: evaluates wherevars() once per feature, threads the resulting array into every provider/processor/filter invocation via appendArgs, and closes AutoCloseable values in LIFO order. Resource leak exists when the wherevars method throws partway through initialization.
spock-core/src/main/java/org/spockframework/runtime/IDataIterator.java Adds getWhereVariableValues() default method and a shared sentinel constant NO_WHERE_VARIABLE_VALUES; the constant is a mutable public array (minor style concern).
spock-core/src/main/java/org/spockframework/runtime/model/FeatureInfo.java Adds whereVariablesMethod nullable field with getter/setter and includes it in hasBytecodeName — clean and consistent with existing pattern.
spock-core/src/main/java/org/spockframework/runtime/SpecInfoBuilder.java Discovers and registers the generated wherevars method on FeatureInfo; straightforward and mirrors existing provider/filter lookup pattern.
spock-specs/src/test/groovy/org/spockframework/smoke/parameterization/WhereBlockVariables.groovy Comprehensive behaviour tests covering data tables, data pipes, derived variables, single-evaluation, combined:, filter:, @Shared access, visibility constraints, and AutoCloseable lifecycle.
spock-specs/src/test/groovy/org/spockframework/smoke/parameterization/InvalidWhereBlocks.groovy Adds compile-error specs for non-final declarations, misplaced declarations, multiple-assignment without final, reserved-prefix violations, and name collision — good negative coverage.
spock-specs/src/test/groovy/org/spockframework/smoke/ast/DataAstSpec.groovy Three new AST snapshot tests covering the simple case, multiple-assignment (Groovy 3/4 vs 5 variants), and a comprehensive combination of all features.
spock-core/src/main/java/org/spockframework/util/InternalIdentifiers.java Adds getWhereVariablesName returning featureName + "wherevars" — consistent naming convention, no issues.
docs/data_driven_testing.adoc Well-written documentation section explaining semantics, access rules, and AutoCloseable lifecycle; the NOTE analogy to @Shared @AutoCleanup(quiet=true) is helpful.

Sequence Diagram

sequenceDiagram
    participant C as Compiler (WhereBlockRewriter)
    participant WV as wherevars() method
    participant P as Provider methods
    participant PR as Processor method
    participant F as Filter method

    Note over C: Compile time
    C->>C: collectWhereBlockVariables()
    C->>WV: generateWhereVariablesMethod()
    C->>P: append whereVar params to provider signatures
    C->>PR: append whereVar params to processor signature
    C->>F: append whereVar params to filter signature

    Note over WV,F: Runtime (once per feature)
    WV-->>WV: evaluate all final initializers

    loop Each iteration
        WV->>P: appendArgs(prevTableArgs, whereVariableValues)
        P-->>P: return data provider object
        P->>PR: appendArgs(rawValues, whereVariableValues)
        PR-->>PR: return processed Object[]
        PR->>F: appendArgs(processedData, whereVariableValues)
        F-->>F: assert filter condition
    end

    Note over WV: Feature teardown
    WV->>WV: closeWhereVariables() LIFO
Loading

Reviews (1): Last reviewed commit: "Auto-close AutoCloseable where-block var..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/data_driven_testing.adoc`:
- Around line 429-431: Reflow the newly added AsciiDoc text so every sentence is
on its own line: find the section that explains declaring a `final` local
variable at the start of the `where:` block (the paragraph starting "Sometimes
you need a helper value to build your data...") and break any wrapped sentences
so each sentence occupies a single line; apply the same one-sentence-per-line
fix to the nearby paragraphs mentioned (around lines described in the comment:
the blocks containing the phrases "final local variable", "start of the `where:`
block", and the subsequent explanatory sentences at 443-450, 455-456, 464-465).
Ensure punctuation is preserved and no sentences are merged or split
incorrectly.

In
`@spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java`:
- Around line 956-975: The generated where-vars method
(createWhereVariablesMethod) must assign each initializer into the result array
immediately and ensure already-initialized AutoCloseable values are cleaned up
if a later initializer throws: modify the method built in
createWhereVariablesMethod so it constructs an Object[] up front, for each
whereBlockVariables entry evaluate the initializer into the corresponding array
slot (e.g., result[i] = <expr>) instead of collecting expressions separately,
and surround the per-element sequence with a try/catch that on exception
iterates the already-assigned slots and closes any AutoCloseable values before
rethrowing; also ensure the method signature and return (currently in MethodNode
created here) still returns the filled Object[] so
FeatureDataProviderIterator.createWhereVariableValues() receives actual values
or sees proper cleanup on failure.
- Around line 225-247: In collectMultipleAssignmentWhereBlockVariables, skip
wildcard placeholders named "_" so they are not treated as exported where-block
variables: when iterating targets in the second loop (the one that currently
does the InternalIdentifiers.isInternalName and isFinalLocal checks and then
adds to whereBlockVariableNames), detect if varExpr.getName().equals("_") and
simply continue (do not perform reserved-name or final checks and do not add to
whereBlockVariableNames) so that patterns like final (_, x) = ... only export x
and duplicate "_" entries are avoided; leave whereBlockVariables.add(stat)
unchanged so the statement is still recorded.

In
`@spock-core/src/main/java/org/spockframework/runtime/DataIteratorFactory.java`:
- Around line 390-405: The close() path can double-close the same AutoCloseable
when a where-variable is also present in dataProviders or dataProviderIterators;
modify close() / closeWhereVariables() to record identities already closed from
dataProviders and dataProviderIterators (e.g., an Identity-based Set populated
when calling closeQuietly on elements of dataProviders and
dataProviderIterators) and then in closeWhereVariables() skip any
whereVariableValues entries whose identity is present in that set, preserving
the reverse-declaration closing order and still ignoring close failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1dc2a863-143a-4435-9aaa-c39726cced32

📥 Commits

Reviewing files that changed from the base of the PR and between 7313c19 and 833222f.

📒 Files selected for processing (18)
  • docs/data_driven_testing.adoc
  • docs/release_notes.adoc
  • spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java
  • spock-core/src/main/java/org/spockframework/runtime/DataIteratorFactory.java
  • spock-core/src/main/java/org/spockframework/runtime/IDataIterator.java
  • spock-core/src/main/java/org/spockframework/runtime/SpecInfoBuilder.java
  • spock-core/src/main/java/org/spockframework/runtime/model/FeatureInfo.java
  • spock-core/src/main/java/org/spockframework/runtime/model/MethodKind.java
  • spock-core/src/main/java/org/spockframework/util/InternalIdentifiers.java
  • spock-specs/src/test/groovy/org/spockframework/docs/datadriven/DataSpec.groovy
  • spock-specs/src/test/groovy/org/spockframework/runtime/StoreSpec.groovy
  • spock-specs/src/test/groovy/org/spockframework/smoke/ast/DataAstSpec.groovy
  • spock-specs/src/test/groovy/org/spockframework/smoke/parameterization/InvalidWhereBlocks.groovy
  • spock-specs/src/test/groovy/org/spockframework/smoke/parameterization/WhereBlockVariables.groovy
  • spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/where_block_variables.groovy
  • spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/where_block_variables_combined_with_data_table__data_pipe__derived_variables__cross_multiplication_and_filter.groovy
  • spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/where_block_variables_with_multiple_assignment-groovy3_4.groovy
  • spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/DataAstSpec/where_block_variables_with_multiple_assignment-groovy5.groovy

Comment thread docs/data_driven_testing.adoc Outdated
Comment thread spock-core/src/main/java/org/spockframework/compiler/WhereBlockRewriter.java Outdated
- reject the '_' wildcard in multiple-assignment where-block variables with a clear error
- validate all multiple-assignment targets before exposing any name, avoiding partial-state corruption
- document NO_WHERE_VARIABLE_VALUES as a shared, must-not-mutate sentinel
- reflow new docs section to one sentence per line and document known auto-close limitations
@testlens-app

testlens-app Bot commented Jun 7, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

⚠️ TestLens detected flakiness ⚠️

Test Summary

Check Project/Task Test Runs
Verify Branches and PRs / Build and Verify (3.0, 8, ubuntu-latest) :spock-specs:test DataTables > filtered iterations are logged ❌ 🚫

🏷️ Commit: 7124dea
▶️ Tests: 489 executed
⚪️ Checks: 33/33 completed


Learn more about TestLens at testlens.app.

@leonard84 leonard84 requested a review from a team June 7, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

where block cannot access or declare variables?

1 participant