Skip to content

slices: make EqSliceFunc more flexible on types#108

Merged
shoenig merged 1 commit intomainfrom
slice-eq-func-flexible
Mar 3, 2023
Merged

slices: make EqSliceFunc more flexible on types#108
shoenig merged 1 commit intomainfrom
slice-eq-func-flexible

Conversation

@shoenig
Copy link
Copy Markdown
Owner

@shoenig shoenig commented Mar 1, 2023

This PR makes EqSliceFunc accept slices of two different types that
are then compared by the supplied comparator - which accepts one of
each type.

Fixes #107

motivating example use

must.SliceEqFunc(t, []string{
  "add",    // PreRun
  "update", // Update
  "remove", // PostRun
  "add",    // PreRun (replacement)
}, ops, func(val regMock.Operation, exp string) bool {
  return val.Op == exp
})

This PR makes EqSliceFunc accept slices of two different types that
are then compared by the supplied comparator - which accepts one of
each type.
@shoenig shoenig force-pushed the slice-eq-func-flexible branch from e665518 to 43347cf Compare March 1, 2023 18:53
@shoenig shoenig marked this pull request as ready for review March 1, 2023 18:58
@shoenig shoenig requested a review from lgfa29 March 1, 2023 18:58
@shoenig shoenig force-pushed the slice-eq-func-flexible branch from 045b9d7 to 43347cf Compare March 3, 2023 21:41
@shoenig shoenig merged commit 6667142 into main Mar 3, 2023
@shoenig shoenig deleted the slice-eq-func-flexible branch December 15, 2023 15:17
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.

bug: SliceEqFunc should be more flexible on type

1 participant