update:Use the official slice operate func (#4841)

This commit is contained in:
me-cs
2025-05-11 19:48:54 +08:00
committed by GitHub
parent 2e91ba5811
commit 072d68f897
4 changed files with 7 additions and 42 deletions

View File

@@ -41,28 +41,6 @@ func TestNotEmpty(t *testing.T) {
}
}
func TestContainsString(t *testing.T) {
cases := []struct {
slice []string
value string
expect bool
}{
{[]string{"1"}, "1", true},
{[]string{"1"}, "2", false},
{[]string{"1", "2"}, "1", true},
{[]string{"1", "2"}, "3", false},
{nil, "3", false},
{nil, "", false},
}
for _, each := range cases {
t.Run(path.Join(each.slice...), func(t *testing.T) {
actual := Contains(each.slice, each.value)
assert.Equal(t, each.expect, actual)
})
}
}
func TestFilter(t *testing.T) {
cases := []struct {
input string