1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/pkg/utils/util_test.go
2019-07-03 11:52:10 -07:00

40 lines
785 B
Go

package utils
import (
"testing"
"gotest.tools/assert"
)
func Test_allEmpty(t *testing.T) {
var list []string
var element string
res := Contains(list, element)
assert.Assert(t, res == false)
}
func Test_emptyList(t *testing.T) {
var list []string
element := "foo"
res := Contains(list, element)
assert.Assert(t, res == false)
}
func Test_emptyElement(t *testing.T) {
list := []string{"foo", "bar"}
var element string
res := Contains(list, element)
assert.Assert(t, res == false)
}
func Test_emptyElementInList(t *testing.T) {
list := []string{"foo", "bar", ""}
var element string
res := Contains(list, element)
assert.Assert(t, res == true)
list = []string{"foo", "bar", "bar"}
element = "bar"
res = Contains(list, element)
assert.Assert(t, res == true)
}