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

add iter() method for StringView #1503

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Yu-zh
Copy link
Collaborator

@Yu-zh Yu-zh commented Jan 17, 2025

No description provided.

Copy link

peter-jerry-ye-code-review bot commented Jan 17, 2025

‼️ This code review is generated by a bot. Please verify the content before trusting it.

Looking at the git diff, here are the potential issues I've identified:

  1. In the StringView::iter implementation, there's no explicit handling of invalid UTF-16 sequences. While it checks for surrogate pairs, it might be good to add error handling or validation for malformed Unicode sequences to prevent potential runtime issues.

  2. In the StringView::iter implementation, the continue index + 2 statement could potentially cause issues if not properly bounds-checked. If index + 2 exceeds self.end, it might lead to unexpected behavior. Consider adding an explicit bounds check.

  3. In the "stringview iter" test case, there's only one test scenario with a simple case. It would be beneficial to add more test cases covering edge cases like:

    • Empty string views
    • Views containing only surrogate pairs
    • Views with invalid Unicode sequences

These suggestions are primarily focused on robustness and test coverage rather than immediate bugs in the code.

@coveralls
Copy link
Collaborator

coveralls commented Jan 17, 2025

Pull Request Test Coverage Report for Build 4818

Details

  • 7 of 9 (77.78%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.008%) to 83.118%

Changes Missing Coverage Covered Lines Changed/Added Lines %
string/view.mbt 7 9 77.78%
Totals Coverage Status
Change from base Build 4812: -0.008%
Covered Lines: 4879
Relevant Lines: 5870

💛 - Coveralls

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.

2 participants