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

Remove leading "/" from PathToStrings #122

Merged
merged 2 commits into from
Dec 4, 2017
Merged

Remove leading "/" from PathToStrings #122

merged 2 commits into from
Dec 4, 2017

Conversation

awly
Copy link
Contributor

@awly awly commented Nov 27, 2017

The "/" is only needed in formatted string from PathToString.

Also add a short sanity unit test for PathToStrings, more detailed cases
are already covered via TestPathToString.

The "/" is only needed in formatted string from PathToString.

Also add a short sanity unit test for PathToStrings, more detailed cases
are already covered via TestPathToString.
@awly awly requested a review from robshakir November 27, 2017 20:18
@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.002% when pulling 5348828 on awly_dev into bbd0df1 on master.

@@ -43,7 +43,7 @@ const (
// representing the path.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest that we add a function comment here that says that the supplied path is always parsed as absolute and therefore should be the concatenation of the prefix plus path if a prefix exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarified that path is absolute.
prefix is a property of Notification, and is not something this package deals with directly.

@@ -109,6 +110,22 @@ func TestPathToString(t *testing.T) {
}
}

func TestPathToStrings(t *testing.T) {
in := &gnmipb.Path{Elem: []*gnmipb.PathElem{
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you make this the standard tests := []struct{ ... }; for _, tt := range tests { ... } layout please? It just makes things easier to extend when/if there are issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I usually insist on the opposite in reviews: only add extra abstraction when it's actually needed.
Given the code sharing between PathToStrings and PathToString, more extra cases can be to TestPathToString.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 91.002% when pulling 35f2d15 on awly_dev into bbd0df1 on master.

@awly
Copy link
Contributor Author

awly commented Dec 1, 2017

ping @robshakir

@robshakir
Copy link
Contributor

Sorry for the delay, LGTM.

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.

3 participants