Expand the corpus to cover every accepted grammar shape#81
Merged
StreamDemon merged 1 commit intoJul 2, 2026
Merged
Conversation
The crates/AGENTS.md rule is "add corpus tests for every grammar shape accepted", but extern blocks, onchain modules, use trees, casts, the literal zoo, async/.await, `?` outside pipes, attribute arguments, and struct-literal shapes had no fixtures. Six new fixtures close those gaps. The harness now discovers `tests/corpus/*.sp` instead of maintaining a hard-coded list, so a new fixture cannot be silently skipped; an is-empty guard catches a moved or emptied corpus directory.
There was a problem hiding this comment.
No issues found across 7 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Test-only PR: adds six corpus fixtures covering grammar shapes and switches harness to auto-discovery. No production code changes.
Re-trigger cubic
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
extern_onchain.sp—extern "C"(plain + async string-target),extern onchain mod, top-levelonchain enum,onchain modwith astorageblock.casts_literals.sp—ascast chains, based integer literals with separators/suffixes (0xFF_FFu32,0b1010_1010u8,u128/u256), float exponents (2.5e-3,1e10f64), string escapes (\x41,\u{1F600}), char literals, lifetimes in generic params and reference types.async_await.sp—async fn,.await,.await?,?chains outside pipes,.context(...).modules_use.sp— inline/file modules,usewith brace lists,pub usere-export, contextualcrate/superpath heads.attributes.sp— bare markers, derive lists, named args (@supervisor(strategy: "one_for_one", ...)), actor-handler@mailbox(capacity: 2048).expressions.sp— struct literals (value position, shorthand init, nesting, parenthesized block-head escape), boolean/comparison operators.tests/corpus/*.spinstead of maintaining a hard-coded list, so a new fixture cannot be silently skipped; an is-empty guard catches a moved or emptied corpus directory. Discovery is sorted for deterministic ordering.Sixth and final sub-PR of the enhancement wave (PR #71 roadmap: "Corpus expansion for all accepted shapes"). Runs last so the fixtures exercise the wave's final code (span tokens, operator enums, attribute args).
Related Issue
None (PR #71 roadmap item).
Spec Sections Affected
None — tests only. Fixtures deliberately stay inside the parser's accepted subset documented in crates/AGENTS.md (no
match/while/for/closures/spawn/emit, no unit-expression(), block-statement;rule respected).Checklist
docs/pages — N/A, tests onlyBuild Targets Tested
cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspaceall green locally (54 tests, 13 corpus fixtures).Test Plan
parses_corpus_filesdiscovers and parses all 13 fixtures (7 existing + 6 new); every fixture parses clean on the wave's final parser.Summary by cubic
Add six new corpus fixtures to cover every accepted grammar shape and switch the test harness to auto-discover all
.spfiles. Improves parser coverage and prevents new fixtures from being skipped.New Features
extern_onchain.sp,casts_literals.sp,async_await.sp,modules_use.sp,attributes.sp,expressions.sp.?, modules/use and re-exports, attributes with named args, struct literals and boolean/comparison ops.Refactors
tests/corpus/*.sp(no hard-coded list) and sorts paths for deterministic runs.Written for commit bbed8be. Summary will update on new commits.