Skip to content

[Foundation] Correct NSRange equality typo and add unit tests for newly added NSRange behaviors #10316

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

Conversation

phausler
Copy link
Contributor

Cherry pick of pr #10282

This fixes rdar://problem/32649690 as well as a few other minor cleanup issues discovered when testing. And most importantly adds unit tests for the new functionality of NSRange

Explanation:
NSRange equality had a typo that incorrectly compared the length. Furthermore there were a few cases where the debugDescription should be improved as well as the string initializer had some edge cases. This commit addresses those failures.

Scope:
This is just runtime behavior of NSRange

Radar (and possibly SR Issue):
rdar://problem/32649690

Risk:
These are newly introduced behaviors that have no current adoption other than the initial seeds.

Testing:
A number of new tests were added to validate the behavior of the new NSRange functionality

@phausler
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@itaiferber itaiferber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — surprising we didn't have these before!

@@ -22,17 +22,23 @@ extension NSRange : Hashable {
}

public static func==(_ lhs: NSRange, _ rhs: NSRange) -> Bool {
return lhs.location == rhs.location && rhs.length == rhs.length
return lhs.location == rhs.location && lhs.length == rhs.length
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wowee

@parkera parkera self-requested a review June 16, 2017 20:57
@tkremenek tkremenek merged commit 2d34fe4 into swiftlang:swift-4.0-branch Jun 16, 2017
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.

5 participants