MCPcopy Index your code
hub / github.com/expr-lang/expr / Test_containsElement

Function Test_containsElement

internal/testify/assert/assertions_test.go:1146–1195  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1144}
1145
1146func Test_containsElement(t *testing.T) {
1147
1148 list1 := []string{"Foo", "Bar"}
1149 list2 := []int{1, 2}
1150 simpleMap := map[interface{}]interface{}{"Foo": "Bar"}
1151
1152 ok, found := containsElement("Hello World", "World")
1153 True(t, ok)
1154 True(t, found)
1155
1156 ok, found = containsElement(list1, "Foo")
1157 True(t, ok)
1158 True(t, found)
1159
1160 ok, found = containsElement(list1, "Bar")
1161 True(t, ok)
1162 True(t, found)
1163
1164 ok, found = containsElement(list2, 1)
1165 True(t, ok)
1166 True(t, found)
1167
1168 ok, found = containsElement(list2, 2)
1169 True(t, ok)
1170 True(t, found)
1171
1172 ok, found = containsElement(list1, "Foo!")
1173 True(t, ok)
1174 False(t, found)
1175
1176 ok, found = containsElement(list2, 3)
1177 True(t, ok)
1178 False(t, found)
1179
1180 ok, found = containsElement(list2, "1")
1181 True(t, ok)
1182 False(t, found)
1183
1184 ok, found = containsElement(simpleMap, "Foo")
1185 True(t, ok)
1186 True(t, found)
1187
1188 ok, found = containsElement(simpleMap, "Bar")
1189 True(t, ok)
1190 False(t, found)
1191
1192 ok, found = containsElement(1433, "1")
1193 False(t, ok)
1194 False(t, found)
1195}
1196
1197func TestElementsMatch(t *testing.T) {
1198 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 3

containsElementFunction · 0.85
TrueFunction · 0.70
FalseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…