fix(assert): say what assert_contains_ignore_case actually folds - #1361
Merged
Conversation
A comment claimed the two implementations fold non-ASCII identically in a UTF-8 locale, and used that to rule out a pure-bash A-Z fold for the Bash 3.0 fallback. Measured on `ÑÜ`: BSD tr (macOS) folds -> ñü GNU tr (Debian) does not -> ÑÜ busybox tr does not -> ÑÜ nocasematch, UTF-8 folds -> matches nocasematch, LC_ALL=C does not -> no match So the branches disagree wherever tr is not BSD, and the fast path disagrees with itself across locales. The Bash 3.0 job runs on Debian, so the difference is in CI, not hypothetical. ASCII folding is the only portable guarantee, so that is what the assertion promises now: stated in the docs, in the comment with the measurements, and pinned by a test that runs on both implementations -- the Bash 3.0 job takes the tr branch, every other job the fast one. Non-ASCII is deliberately left unasserted rather than pinned to whichever platform the test happens to run on. No behaviour change. The wider point is worth keeping: `tr` is not one implementation, and any claim that a pure-bash construct and an external tool agree needs BSD, GNU and busybox, not just a developer's Mac. Closes #1351 Claude-Session: https://claude.ai/code/session_01EXYWTGLjf7qM8Ru3GakDRm
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
Related #1351
A comment claimed both implementations fold non-ASCII identically in a UTF-8 locale, and used that to rule out a pure-bash A-Z fold for the Bash 3.0 fallback. Measured on
ÑÜ: BSDtrfolds it, GNU and busyboxtrdo not, andnocasematchfolds it under UTF-8 but not underLC_ALL=C. The Bash 3.0 job runs on Debian, so the difference is in CI.💡 Changes
trbranch, every other job thenocasematchone. Non-ASCII is deliberately left unasserted rather than pinned to whichever platform the test happens to run on.bashunit docsnapshot for the doc line.trforks off the Bash 3.0 path.https://claude.ai/code/session_01EXYWTGLjf7qM8Ru3GakDRm