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

Port Contains method #4

Merged
merged 2 commits into from
Dec 1, 2022
Merged

Port Contains method #4

merged 2 commits into from
Dec 1, 2022

Conversation

saswatamcode
Copy link
Collaborator

This ports the Contains method from Thanos testutil package.

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Copy link
Contributor

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks!

Some comment, WDYT?

@@ -92,6 +92,52 @@ func FaultOrPanicToErr(f func()) (err error) {
return err
}

// Contains fails the test if needle is not contained within haystack, if haystack or needle is
// an empty slice, or if needle is longer than haystack.
func Contains(tb testing.TB, haystack, needle []string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be.... generic? ;p

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise, let's use ContainsStringSlice function name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right! Something generic would suit here. Let me try to tackle that in next PR. Changing name for now! 🙂

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Copy link
Contributor

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks!

@bwplotka bwplotka merged commit ba593f6 into efficientgo:main Dec 1, 2022
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