test: comprehensive walker API tests (517 new tests)#50
Merged
toddr merged 1 commit intoApr 24, 2026
Merged
Conversation
The existing t/03walker.t only tested quantifiers on a single pattern
(^a+b*?c{5,}d{3}$). This adds 517 tests validating tree structure for:
- Capturing and non-capturing groups
- Alternation (bare and in groups)
- Character classes (literal, range, negated, shorthand)
- All assertion types (lookahead, lookbehind, atomic)
- Backreferences and named captures
- Conditionals (with and without else branch)
- Flag groups and caret flags
- Anchors and word boundaries
- Unicode properties
- Possessive quantifiers
- Branch reset groups
- Recursive patterns and backtracking verbs
- Script runs and extended character classes
- Walker depth parameter (0, 1, -1)
- Nested groups and quantified groups
- Complex multi-construct patterns
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
What
Adds 517 tests validating the walker() API's tree traversal across all node families.
Why
The existing t/03walker.t only tests one simple pattern (
^a+b*?c{5,}d{3}$) covering quantifiers and anchors. The walker is the primary API for consuming parse results, but its output was largely unverified for groups, alternation, character classes, assertions, backreferences, conditionals, and all modern Perl 5.10+ constructs.How
Each test case parses a pattern, walks the tree, and validates every node's depth, family, type, and visual. Covers 30+ distinct constructs including edge cases like empty groups, nested captures, and walker depth limiting. Uses
done_testingsince test count depends on Perl version (SKIP blocks for 5.18+ and 5.28+ features).Testing
All 1672 tests pass (517 new + 1155 existing). Tested on Perl 5.42.
🤖 Generated with Claude Code