-
Notifications
You must be signed in to change notification settings - Fork 2
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
Change substring() to use startIndex, endIndex
instead of startIndex, length
#85
Conversation
Codecov Report
@@ Coverage Diff @@
## master #85 +/- ##
============================================
+ Coverage 75.86% 76.30% +0.44%
- Complexity 12737 12803 +66
============================================
Files 1060 1037 -23
Lines 64353 60637 -3716
Branches 7110 7136 +26
============================================
- Hits 48821 46270 -2551
+ Misses 12891 11917 -974
+ Partials 2641 2450 -191
... and 40 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Looks good to me, just a few minor docs nits and I think it's ready for an external PR.
...e/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
Outdated
Show resolved
Hide resolved
// to the positive index position or 0 when negative index exceeds the string length, which means an empty string | ||
// will be returned, if it is positive and exceeds the length of the string, it is converted to the length of the | ||
// string. | ||
private int processEndIndex(int strLen) { |
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 is basically the same function as processStartIndex(). Consider refactoring.
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.
Merged into processStringIndex()
assertEquals("ello world", __.__("hello world").substring(1, 11).next()); | ||
assertEquals("d", __.__("hello world").substring(10, 11).next()); | ||
assertEquals("hello world", __.__("hello world").substring(-11, 11).next()); | ||
assertEquals("h", __.__("hello world").substring(-11, 1).next()); |
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.
Missing a test for two negative numbers like (-3,-2).
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.
Added (-3, -1) and (-1, -3) cases
@@ -55,11 +55,11 @@ Feature: Step - substring() | |||
| p | | |||
| pple | | |||
|
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.
General comment, I would add some feature test cases with combinations of (pos start index, neg end index), (neg start index, pos end index), and (neg start index, neg end index).
02b865b
to
c87171b
Compare
No description provided.