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

dev: Add more tests for parseCmd #90

Merged
merged 2 commits into from
Sep 10, 2024
Merged

dev: Add more tests for parseCmd #90

merged 2 commits into from
Sep 10, 2024

Conversation

jdkaplan
Copy link
Collaborator

I wanted to understand the parser tests better, so I collected them into good/bad groups and added some more cases that weren't tested before.

@jdkaplan jdkaplan force-pushed the jdk-parser-tests branch 2 times, most recently from 17c3a79 to bbc1605 Compare September 10, 2024 02:44
parse_cmd_test.go Show resolved Hide resolved
Comment on lines +42 to +45
"get-reviews 0": {"get-reviews", []string{"0"}},
"get-reviews 1": {"get-reviews", []string{"1"}},
"get-reviews 5": {"get-reviews", []string{"5"}},
"get-reviews 10": {"get-reviews", []string{"10"}},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I want to argue that get-reviews 0 is a bug, but it has funny output, so I'm keeping it 😄

@jdkaplan jdkaplan marked this pull request as ready for review September 10, 2024 02:46
var rejectedCommands = []string{
"",

// Funnily enough, these *do* give you what you want!
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there another TODO task here, "make help match generously"? On any string with help in it (that isn't add-review.*),

It seems like you're asking for help -- here's how to use Pairing Bot:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From a functionality perspective, the user does still get the help text! Well, they should, but I broke that here by being over-eager on error returns. I'll stack another commit on here to fix that.

I could see the default-to-help error path having a nicer version of the message that starts with your suggestion! I'll sneak it into the next PR where I refactor the parser itself to be infallible.

parse_cmd_test.go Outdated Show resolved Hide resolved
@cceckman
Copy link
Collaborator

OK hi! I left a bunch of nitpicky comments which you should feel free to ignore -- they're all strictly about Golang style. The semantics of the change are great and helpful -- thank you!


For background, I'm used to doing three kinds of code review:

  • Peer review, "does this make sense internally with the change description / locally"
  • Ownership for a codebase I'm responsible for, "does this change align with the goals / directions of this product"
  • Readability / style, "is this idiomatic in the language" (more words; specifically for Golang.

I don't care about enforcing the Golang style guide on this project, and I would never want it to block a contribution. But I do see where sticking with cross-project idioms can help people onboard -- if not to Pairing Bot, into other Golang environments. (I'm sure using if got, want := ...; got != want{} in an interview at Google would be a positive signal.)

So, feedback-on-feedback: Are these (kinds of) comments useful? Or not worth the time on either end?

Copy link
Collaborator

@cceckman cceckman left a comment

Choose a reason for hiding this comment

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

As noted in comments, all of these are nits / questions -- looks great!

Copy link
Collaborator Author

@jdkaplan jdkaplan left a comment

Choose a reason for hiding this comment

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

We seem to have settled on very similar code review conventions, somehow! This review felt very familiar 😄

So, feedback-on-feedback: Are these (kinds of) comments useful? Or not worth the time on either end?

Yes, very worth it! In particular, I think that we have overlapping-but-slightly-different Go experiences, so I definitely want to know what stands out to you as you're reading my code.

Especially since you make the non-blocking comments truly non-blocking by approving the PR anyway! (not that blocking applies to me as an admin, but you get the idea)

parse_cmd_test.go Show resolved Hide resolved
var rejectedCommands = []string{
"",

// Funnily enough, these *do* give you what you want!
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From a functionality perspective, the user does still get the help text! Well, they should, but I broke that here by being over-eager on error returns. I'll stack another commit on here to fix that.

I could see the default-to-help error path having a nicer version of the message that starts with your suggestion! I'll sneak it into the next PR where I refactor the parser itself to be infallible.

parse_cmd_test.go Outdated Show resolved Hide resolved
parse_cmd_test.go Show resolved Hide resolved
parse_cmd_test.go Show resolved Hide resolved
@jdkaplan jdkaplan merged commit ac9e695 into main Sep 10, 2024
3 checks passed
@jdkaplan jdkaplan deleted the jdk-parser-tests branch September 10, 2024 17:35
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