1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 14:42:27 +08:00

feat: add ContainsAll and ContainsAny

This commit is contained in:
dudaodong
2023-05-31 10:51:16 +08:00
parent 09ec5b97a6
commit 2894bec80c
3 changed files with 71 additions and 0 deletions

View File

@@ -450,3 +450,19 @@ func TestHideString(t *testing.T) {
assert.Equal("1324265****", HideString(str, 7, 100, "*"))
assert.Equal("13242658976", HideString(str, 100, 100, "*"))
}
func TestContainsAll(t *testing.T) {
assert := internal.NewAssert(t, "TestContainsAll")
assert.Equal(true, ContainsAll("hello world", []string{"hello", "world"}))
assert.Equal(true, ContainsAll("hello world", []string{""}))
assert.Equal(false, ContainsAll("hello world", []string{"hello", "abc"}))
}
func TestContainsAny(t *testing.T) {
assert := internal.NewAssert(t, "TestContainsAny")
assert.Equal(true, ContainsAny("hello world", []string{"hello", "world"}))
assert.Equal(true, ContainsAny("hello world", []string{"hello", "abc"}))
assert.Equal(false, ContainsAny("hello world", []string{"123", "abc"}))
}