add unit test coverage for pkg/util/slice

Signed-off-by: zhoumingcheng <zhoumingcheng@beyondcent.com>
This commit is contained in:
zhoumingcheng 2022-06-30 15:21:37 +08:00
parent b2ed6ca64f
commit 509c487fe8

View File

@ -78,6 +78,11 @@ func TestContainsString(t *testing.T) {
if !ContainsString(src, "ee", modifier) { if !ContainsString(src, "ee", modifier) {
t.Errorf("ContainsString didn't find the string by modifier") t.Errorf("ContainsString didn't find the string by modifier")
} }
src = make([]string, 0)
if ContainsString(src, "", nil) {
t.Errorf("The result returned is not the expected result")
}
} }
func TestRemoveString(t *testing.T) { func TestRemoveString(t *testing.T) {