MCPcopy
hub / github.com/expr-lang/expr / Contains

Function Contains

internal/testify/assert/assertions.go:926–941  ·  view source on GitHub ↗

Contains asserts that the specified string, list(array, slice...) or map contains the specified substring or element. assert.Contains(t, "Hello World", "World") assert.Contains(t, ["Hello", "World"], "World") assert.Contains(t, {"Hello": "World"}, "Hello")

(t TestingT, s, contains interface{}, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

924// assert.Contains(t, ["Hello", "World"], "World")
925// assert.Contains(t, {"Hello": "World"}, "Hello")
926func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
927 if h, ok := t.(tHelper); ok {
928 h.Helper()
929 }
930
931 ok, found := containsElement(s, contains)
932 if !ok {
933 return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...)
934 }
935 if !found {
936 return Fail(t, fmt.Sprintf("%#v does not contain %#v", s, contains), msgAndArgs...)
937 }
938
939 return true
940
941}
942
943// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
944// specified substring or element.

Callers 15

TestExpr_eval_with_envFunction · 0.92
TestExpr_fetch_from_funcFunction · 0.92
TestMaxNodesFunction · 0.92
TestMemoryBudgetFunction · 0.92
TestCheck_PointerNodeFunction · 0.92
TestInterfaceHideFunction · 0.92
ContainsFunction · 0.92
TestBuiltin_errorsFunction · 0.92

Calls 4

containsElementFunction · 0.85
SprintfMethod · 0.80
FailFunction · 0.70
HelperMethod · 0.45

Tested by 15

TestExpr_eval_with_envFunction · 0.74
TestExpr_fetch_from_funcFunction · 0.74
TestMaxNodesFunction · 0.74
TestMemoryBudgetFunction · 0.74
TestCheck_PointerNodeFunction · 0.74
TestInterfaceHideFunction · 0.74
TestBuiltin_errorsFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…