From edff5a049b1c4eacd84bec25bcf7e7852b7c1163 Mon Sep 17 00:00:00 2001 From: Menno Date: Sun, 4 Jul 2021 16:20:17 +0200 Subject: [PATCH] fix funtion name --- assert/assertions.go | 10 +++++----- assert/assertions_test.go | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/assert/assertions.go b/assert/assertions.go index c91fcbfc0..79a115088 100644 --- a/assert/assertions.go +++ b/assert/assertions.go @@ -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...) } diff --git a/assert/assertions_test.go b/assert/assertions_test.go index c6fbb7679..880f9cc43 100644 --- a/assert/assertions_test.go +++ b/assert/assertions_test.go @@ -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) }