-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add String#byteindex and String#byterindex #2449
Add String#byteindex and String#byterindex #2449
Conversation
The current CI failure seems to be related to rust-lang/rust#109424 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks good, the functions do what I expect. Thanks for updating the doc tests to have multibyte UTF-8 characters.
I think you've got about the right amount of doc test examples.
Can you add real tests that are a bit more exhaustive? I'd like to see the following coverage:
- all encodings for the receiver
None
given as needleSome([])
- ASCII needles
- Binary needles
- UTF-8 needles with multibyte chars
- testing on UTF-8 encoded strings that have binary contents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great.
Once rust-lang/rust#109500 is resolved I think the rustdoc build will be fixed and I'll poke CI to get this merged.
(Ops sorry I somehow didn't send out the comments yesterday 😅)
Thanks for the detailed review! I've added the test only for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you this is good to go. It looks like the rust doc folks are making progress on the nightly breakage. I'm following upstream and will poke the build here when nightly is fixed so we can get this merged.
nightly rustdoc is fixed, the build is green, merging. thanks for the contribution @choznerol. |
Fix #2361
In this PR,
byteindex
andbyterindex
will become available forString
just likeindex
andrindex
.The incorrect output of
index
andrindex
is a separate bug that is tracked by #2360.Please let me know if equivalent amount of doctest is preferred for all four methods. I was just a bit of worry about being too verbose, so there isn't too many test case for some of them.