fix(assert): repair the no-perl snapshot placeholder fallback#823
Merged
Conversation
The Alpine CI runs of #822 caught the grep fallback of snapshot::match_with_placeholder broken: it escaped regex metacharacters AFTER substituting the placeholder with '.*', so the wildcard itself got escaped and the pattern could never match — every placeholder assertion on a perl-less system failed (or matched wrongly under busybox grep). Build the pattern exactly like the perl branch instead: swap the placeholder for an escape-proof token, escape the metacharacters, then expand the token to '.*'. Multi-line placeholders remain perl-only (grep matches line-by-line); the multi-line unit test now skips without perl and the fallback limitation is documented inline. Closes the red Alpine jobs introduced by #822.
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.
🤔 Background
The new placeholder unit tests in #822 failed on Alpine (no perl) — correctly: the grep fallback of
match_with_placeholderescaped regex metacharacters after substituting the placeholder with.*, escaping the wildcard itself, so fallback placeholders never worked.💡 Changes
.*. Verified locally with perl masked: literal match, metachar rejection, custom placeholder and mid-line placeholder all behave like the perl path.