Repository navigation
Conversation
Since 0.061 the pre_subtest callback pushed each subtest name onto the parent hub's meta and never removed it, so a finished sibling's name leaked into the path of every later sibling (and into the parent level after the subtests ended), e.g. outer/a/b/v instead of outer/b/v. Record only the running child's name on the parent hub, and when building the path use, for each Test2::Hub::Subtest on the stack, the name Test::Builder stored on that hub (as 0.06 did, covering subtest() and Test::Builder->child) or else the name recorded on the hub below it (Test2::V0's subtest). Non-subtest hubs such as intercept's add no name. This also drops the `//` operator, which MIN_PERL_VERSION 5.8.3 does not have. Co-Authored-By: Claude Opus 5.5 <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.
Problem
A regression from #3 (released in 0.061): the
pre_subtestcallback pushes each subtest name onto the parent hub's meta and never removes it. A finished sibling's name therefore leaks into the snapshot path of every later sibling, and into the parent level once the subtests have ended. This happens under both Test::More and Test2::V0.outer/a/vouter/a/vouter/b/vouter/a/b/vouter/c/vouter/a/b/c/vThis contradicts the POD ("any subtests names surrounding and including this one"). It also means that adding, removing or reordering one subtest changes the path of every sibling after it. Existing 0.06 snapshots in loop-generated sibling subtests fail with
No snapshot filename ... found.Fix
_get_filenametakes one name for eachTest2::Hub::Subteston the stack:subtestandTest::Builder->child.subtest.interceptpushes, add no name.//operator is gone, so the code builds again on the declaredMIN_PERL_VERSION(5.8.3).Known limitation: a hub that is a subclass of
Test2::Hub::Subtest, created by a mechanism that neither firespre_subtestcallbacks nor sets a Test::Builder name, could still pick up a stale name. Test2::AsyncSubtest might be one; I have not checked.Tests
t/subtest-names-testmore.tandt/subtest-names-test2.tcheck the generated paths in these cases:interceptTest::Builder->child, Test::More file onlyBoth files fail on 0.061 and pass with this change.
prove -l tpasses.Note for the release
Snapshots generated with 0.061 for sibling subtests were written to the accumulated paths. Those users will need to regenerate them, or move them back to the 0.06 paths. I left
Changesand$VERSIONto you.🤖 Generated with Claude Code