Skip to content

Conversation

@mikestephen
Copy link

Proposed changes

Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue here in this description (not in the title of the PR).

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto master
  • I will ensure my PR is targeting the master branch and pulling from my branch from my own fork

var proxyBuffersRegexp = regexp.MustCompile(`^\d+ \d+[kKmM]?$`)

// ParseProxyBuffersSpec ensures that the string value is a valid proxy buffer spec
func ParseProxyBuffersSpec(s string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

would it help to have a unit test for this func?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I'd forgotten, added one now.

t.Errorf("ParseProxyBuffersSpec(%q) returned an error for valid input", test)
}
if test != result {
t.Errorf("TestParseProxyBuffersSpec(%q) returned %q expected %q", test, result, test)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Errorf("TestParseProxyBuffersSpec(%q) returned %q expected %q", test, result, test)
t.Errorf("ParseProxyBuffersSpec(%q) returned %q expected %q", test, result, test)

for _, test := range invalidInput {
result, err := ParseProxyBuffersSpec(test)
if err == nil {
t.Errorf("TestParseProxyBuffersSpec(%q) didn't return error. Returned: %q", test, result)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Errorf("TestParseProxyBuffersSpec(%q) didn't return error. Returned: %q", test, result)
t.Errorf("ParseProxyBuffersSpec(%q) didn't return error. Returned: %q", test, result)

@mikestephen mikestephen merged commit e61b57f into master Jan 28, 2021
@mikestephen mikestephen deleted the additional-annotation-validation-1 branch January 28, 2021 14:51
@lucacome lucacome added the enhancement Pull requests for new features/feature enhancements label Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Pull requests for new features/feature enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants