Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a matcher char_count to match string slices and owned strings with a particular character count. #247

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

hovinen
Copy link
Collaborator

@hovinen hovinen commented Jun 30, 2023

Previously, there was no matcher on just the length of a string. The existing matcher len only works on containers, not strings.

The concept of "length of a string" is itself slightly ambiguous -- it could mean byte length, character count, or number of grapheme clusters. This matcher unambiguously counts characters, which should be correct in most cases.

@hovinen hovinen force-pushed the create-matcher-char-count branch 2 times, most recently from 119e605 to 104e8f0 Compare July 7, 2023 11:52
…ings with a particular character count.

Previously, there was no matcher on just the length of a string. The existing matcher `len` only works on containers, not strings.

The concept of "length of a string" is itself slightly ambiguous -- it could mean byte length, character count, or number of grapheme clusters. This matcher unambiguously counts characters, which should be correct in most cases.
@hovinen hovinen force-pushed the create-matcher-char-count branch from 104e8f0 to bdb26d3 Compare July 7, 2023 12:02
@copybara-service copybara-service bot merged commit 9c92629 into main Jul 7, 2023
@gribozavr gribozavr deleted the create-matcher-char-count branch February 17, 2025 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant