Skip to content

Parse the skip keyword argument of @testitem - #35

Merged
davidanthoff merged 1 commit into
mainfrom
s1-discovery
Aug 13, 2026
Merged

Parse the skip keyword argument of @testitem#35
davidanthoff merged 1 commit into
mainfrom
s1-discovery

Conversation

@davidanthoff

Copy link
Copy Markdown
Member

Part of stream S1 (Discovery) of the ReTestItems feature-delta plan — A.10 item 5, "skip as an item kwarg".

Depends on julia-testitems/TestItems.jl#40 (docstring only, no code dependency).

What

find_test_detail! gains a skip branch alongside the existing tags / default_imports / setup branches, following the same shape:

  • duplicate-keyword error: "The keyword argument skip cannot be specified more than once."
  • a literal true / false is resolved here and returned as a Bool
  • anything else is returned as the source range of the expression — mirroring how the body is returned as code_range — so the consumer can slice the text and evaluate it in the test process just before the item would run
  • default false
  • skip no longer hits the unknown-keyword error

Returned as option_skip in the named tuple pushed to testitems.

Note: parentheses are trivia to JuliaSyntax, so skip=(VERSION < v"1.11") yields the range of VERSION < v"1.11" without the wrapping parens. Consumers that splice the text into generated code should parenthesize it themselves.

Testing

New test/test_skip.jl covers: default, literal true, literal false, expression form (two shapes), duplicate skip, skip combined with the other keywords, and that unknown keywords are still rejected. Run via the MCP julia_run_testitems tools: 8/8 passing.

Downstream

option_skip is a new field on the tuple, so JuliaWorkspaces.jl must land its companion PR in lockstep (it adds option_skip::Union{Bool,String} to TestItemDetail).

🤖 Generated with Claude Code

`find_test_detail!` gains a `skip` branch alongside `tags`,
`default_imports` and `setup`, so `skip` no longer trips the unknown-keyword
error. A literal `true`/`false` is resolved here and returned as a `Bool`;
anything else is returned as the source range of the expression, the same way
the body is returned as `code_range`, so callers can slice the text and hand
it to the test process for evaluation just before the item runs. Defaults to
`false`.

The value is returned as `option_skip` on the named tuple pushed to
`testitems`.

Adds test items for the literal, expression, default, duplicate-keyword and
combined-keyword cases. They live in `test/test_skip.jl` because they exercise
the parser directly; the round-trip tests through the workspace layer stay in
JuliaWorkspaces.jl.

Part of stream S1 (Discovery) of the ReTestItems feature-delta plan
(A.10 item 5).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@davidanthoff
davidanthoff marked this pull request as ready for review August 13, 2026 23:18
@davidanthoff
davidanthoff merged commit e9e6464 into main Aug 13, 2026
8 of 79 checks passed
@davidanthoff
davidanthoff deleted the s1-discovery branch August 13, 2026 23:18
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.

1 participant