-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[#31756][Prism] Add a test for getting state with MultimapSideInput StateKey #31757
Conversation
Assigning reviewers. If you would like to opt out of this review, comment R: @jrmccluskey for label go. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
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.
Thank you very much!
Honestly, I couldn't find any good nits with this code, but I did leave my initial draft comments with links to the applicable external readability resource. I'll go ahead and merge this.
}, | ||
} | ||
var testKey = []string{"a", "b", "x"} | ||
expectedResult := map[string][]int{ |
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.
Nit: in Go, we tend to use got
and want
as the idiomatic test words for what was received after processing
and results that were desired
.
But TBH since this is a lookup table for any specific want
I think what's here is fine vs having want[key]
downstream. The non-standard name makes the lookup pattern more visible.
for _, b := range resp.GetGet().GetData() { | ||
got = append(got, int(b)) | ||
} | ||
if !cmp.Equal(got, expectedResult[key]) { |
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.
Edit: Once I realized that this was comparing just individual primitive values, there's no real need for cmp.Diff. But here's the original comment I put down.
Consider using cmp.Diff
instead which will provided a good printout for this.
See https://go.dev/wiki/TestComments#print-diffs
Note that for cmp.Diff, you want to pass want
before got
so the diff would be (-want, +got), which shows what's missing from what's wanted, and extra in what's received.
Aside: You're already doing the other usual bit of advice correctly for the message here "got before want": See https://go.dev/wiki/TestComments#got-before-want
This addresses #31756 to increase test coverage of Prism.