-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Fix inheritance of custom path segmenter #19
Conversation
b291a11
to
365cd8a
Compare
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.
Thanks for the fix. The proposed test seems more involved than might be needed but otherwise lgtm
segmenter_test.go
Outdated
@@ -72,3 +73,62 @@ func TestPathSegmenterEdgeCases(t *testing.T) { | |||
} | |||
} | |||
} | |||
|
|||
type testDepth struct { |
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 type and the arm
field don't seem to really be needed. Your example dot segmenter could just be a plain function.
segmenter_test.go
Outdated
}) | ||
} | ||
for k, ok := range depthTest.cases { | ||
t.Run("walk "+k, func(t *testing.T) { |
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.
t.Run
shouldn't be needed I don't think. Just loop and find any false values.
segmenter_test.go
Outdated
|
||
func TestCustomPathSegmenter(t *testing.T) { | ||
depthTest := testDepth{ | ||
cases: map[string]bool{ |
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.
I'd comment this // key -> visited
and move it to be after the tie
is created to be more clear
365cd8a
to
40e58ab
Compare
Should be fixed now, it was mostly leftovers of other way I tried to test it and forgot to cleanup. |
Thanks! |
Currently children nodes of path segmenter will always use default segmenter regardless of settings.
First commit tests for the problem, second commits adds function that creates new PathTrie with inherited settings