MCPcopy
hub / github.com/stretchr/testify / Test_containsElement

Function Test_containsElement

assert/assertions_test.go:1275–1325  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1273}
1274
1275func Test_containsElement(t *testing.T) {
1276 t.Parallel()
1277
1278 list1 := []string{"Foo", "Bar"}
1279 list2 := []int{1, 2}
1280 simpleMap := map[interface{}]interface{}{"Foo": "Bar"}
1281
1282 ok, found := containsElement("Hello World", "World")
1283 True(t, ok)
1284 True(t, found)
1285
1286 ok, found = containsElement(list1, "Foo")
1287 True(t, ok)
1288 True(t, found)
1289
1290 ok, found = containsElement(list1, "Bar")
1291 True(t, ok)
1292 True(t, found)
1293
1294 ok, found = containsElement(list2, 1)
1295 True(t, ok)
1296 True(t, found)
1297
1298 ok, found = containsElement(list2, 2)
1299 True(t, ok)
1300 True(t, found)
1301
1302 ok, found = containsElement(list1, "Foo!")
1303 True(t, ok)
1304 False(t, found)
1305
1306 ok, found = containsElement(list2, 3)
1307 True(t, ok)
1308 False(t, found)
1309
1310 ok, found = containsElement(list2, "1")
1311 True(t, ok)
1312 False(t, found)
1313
1314 ok, found = containsElement(simpleMap, "Foo")
1315 True(t, ok)
1316 True(t, found)
1317
1318 ok, found = containsElement(simpleMap, "Bar")
1319 True(t, ok)
1320 False(t, found)
1321
1322 ok, found = containsElement(1433, "1")
1323 False(t, ok)
1324 False(t, found)
1325}
1326
1327func TestElementsMatch(t *testing.T) {
1328 t.Parallel()

Callers

nothing calls this directly

Calls 3

containsElementFunction · 0.85
TrueFunction · 0.70
FalseFunction · 0.70

Tested by

no test coverage detected