fix: generalize test_document/test_statement into Helper.pm#446
Draft
toddr-bot wants to merge 2 commits into
Draft
fix: generalize test_document/test_statement into Helper.pm#446toddr-bot wants to merge 2 commits into
toddr-bot wants to merge 2 commits into
Conversation
…Helper Adds tests verifying that Helper.pm exports test_document and test_statement functions with correct behavior: - Export availability checks - test_statement with explicit Statement class in expected - test_statement with auto-wrapping (no Statement prefix) - test_document with simple code - test_document with PPI::Document options (feature_mods) Marked $TODO since the functions are not yet extracted from individual test files into the shared module. See #445 for context on generalizing these test helpers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract duplicate test_document and test_statement functions from five test files into the shared t/lib/Helper.pm module. Both functions parse code, extract significant elements as class/content pairs, and compare against expected arrays with helpful diagnostics on failure. test_document accepts an optional leading arrayref of PPI::Document options. test_statement auto-wraps expected arrays that don't start with PPI::Statement. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
|
Try and deduplicate the internals of test_document and test_statement. @toddr-bot fix |
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
Extracts the duplicated
test_documentandtest_statementhelper functions from five test files into the sharedt/lib/Helper.pmmodule, eliminating ~100 lines of copy-pasted code.Fixes #445
Changes
test_documentandtest_statementtoHelper.pmwith@EXPORT_OK_one_line_explainand_main_level_linediagnostic helperst/feature_tracking.t,t/signature_details.t,t/ppi_token_unknown.t,t/ppi_token_quote_literal.t, andt/marpa.tto import from Helper instead of defining locallyt/helper_test_functions.tto verify the exported functions work correctlyTest plan
t/helper_test_functions.tvalidates both functions with various inputstest_statementauto-wrap behavior andtest_documentoptions passthroughGenerated by Kōan /fix
Quality Report
Changes: 7 files changed, 183 insertions(+), 200 deletions(-)
Code scan: 1 issue(s) found
t/lib/Helper.pm:156— TODO commentTests: skipped
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline