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

Fix inheritance of custom path segmenter #19

Merged
merged 2 commits into from
May 6, 2021

Conversation

XANi
Copy link
Contributor

@XANi XANi commented Apr 1, 2021

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

@XANi XANi force-pushed the fix-custom-path-segmenter branch 2 times, most recently from b291a11 to 365cd8a Compare April 1, 2021 20:09
Copy link
Owner

@dghubble dghubble left a 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

@@ -72,3 +73,62 @@ func TestPathSegmenterEdgeCases(t *testing.T) {
}
}
}

type testDepth struct {
Copy link
Owner

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.

})
}
for k, ok := range depthTest.cases {
t.Run("walk "+k, func(t *testing.T) {
Copy link
Owner

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.


func TestCustomPathSegmenter(t *testing.T) {
depthTest := testDepth{
cases: map[string]bool{
Copy link
Owner

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

@XANi XANi force-pushed the fix-custom-path-segmenter branch from 365cd8a to 40e58ab Compare May 6, 2021 16:26
@XANi
Copy link
Contributor Author

XANi commented May 6, 2021

Should be fixed now, it was mostly leftovers of other way I tried to test it and forgot to cleanup.

@dghubble dghubble merged commit 7bfa5d9 into dghubble:master May 6, 2021
@dghubble
Copy link
Owner

dghubble commented May 6, 2021

Thanks!

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