fix funtion name

This commit is contained in:
Menno 2021-07-04 16:20:17 +02:00 committed by Boyan Soubachov
parent 5c61ef97ae
commit edff5a049b
2 changed files with 17 additions and 17 deletions

View File

@ -718,7 +718,7 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte
// return (false, false) if impossible.
// return (true, false) if element was not found.
// return (true, true) if element was found.
func includeElement(list interface{}, element interface{}) (ok, found bool) {
func containsElement(list interface{}, element interface{}) (ok, found bool) {
listValue := reflect.ValueOf(list)
listType := reflect.TypeOf(list)
@ -768,7 +768,7 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo
h.Helper()
}
ok, found := includeElement(s, contains)
ok, found := containsElement(s, contains)
if !ok {
return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...)
}
@ -791,7 +791,7 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
h.Helper()
}
ok, found := includeElement(s, contains)
ok, found := containsElement(s, contains)
if !ok {
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...)
}
@ -835,7 +835,7 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok
for i := 0; i < subsetValue.Len(); i++ {
element := subsetValue.Index(i).Interface()
ok, found := includeElement(list, element)
ok, found := containsElement(list, element)
if !ok {
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
}
@ -879,7 +879,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{})
for i := 0; i < subsetValue.Len(); i++ {
element := subsetValue.Index(i).Interface()
ok, found := includeElement(list, element)
ok, found := containsElement(list, element)
if !ok {
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
}

View File

@ -732,53 +732,53 @@ func TestNotSubsetNil(t *testing.T) {
}
}
func Test_includeElement(t *testing.T) {
func Test_containsElement(t *testing.T) {
list1 := []string{"Foo", "Bar"}
list2 := []int{1, 2}
simpleMap := map[interface{}]interface{}{"Foo": "Bar"}
ok, found := includeElement("Hello World", "World")
ok, found := containsElement("Hello World", "World")
True(t, ok)
True(t, found)
ok, found = includeElement(list1, "Foo")
ok, found = containsElement(list1, "Foo")
True(t, ok)
True(t, found)
ok, found = includeElement(list1, "Bar")
ok, found = containsElement(list1, "Bar")
True(t, ok)
True(t, found)
ok, found = includeElement(list2, 1)
ok, found = containsElement(list2, 1)
True(t, ok)
True(t, found)
ok, found = includeElement(list2, 2)
ok, found = containsElement(list2, 2)
True(t, ok)
True(t, found)
ok, found = includeElement(list1, "Foo!")
ok, found = containsElement(list1, "Foo!")
True(t, ok)
False(t, found)
ok, found = includeElement(list2, 3)
ok, found = containsElement(list2, 3)
True(t, ok)
False(t, found)
ok, found = includeElement(list2, "1")
ok, found = containsElement(list2, "1")
True(t, ok)
False(t, found)
ok, found = includeElement(simpleMap, "Foo")
ok, found = containsElement(simpleMap, "Foo")
True(t, ok)
True(t, found)
ok, found = includeElement(simpleMap, "Bar")
ok, found = containsElement(simpleMap, "Bar")
True(t, ok)
False(t, found)
ok, found = includeElement(1433, "1")
ok, found = containsElement(1433, "1")
False(t, ok)
False(t, found)
}