(t *testing.T)
| 1375 | } |
| 1376 | |
| 1377 | func TestArray_HasValue(t *testing.T) { |
| 1378 | t.Run("basic", func(t *testing.T) { |
| 1379 | cases := []struct { |
| 1380 | name string |
| 1381 | array []interface{} |
| 1382 | index int |
| 1383 | value interface{} |
| 1384 | wantHasValue chainResult |
| 1385 | wantNotHasValue chainResult |
| 1386 | }{ |
| 1387 | { |
| 1388 | name: "index zero check", |
| 1389 | array: []interface{}{ |
| 1390 | 123, |
| 1391 | []interface{}{"456", 789}, |
| 1392 | map[string]interface{}{ |
| 1393 | "a": "b", |
| 1394 | }, |
| 1395 | }, |
| 1396 | index: 0, |
| 1397 | value: 123, |
| 1398 | wantHasValue: success, |
| 1399 | wantNotHasValue: failure, |
| 1400 | }, |
| 1401 | { |
| 1402 | name: "index one check", |
| 1403 | array: []interface{}{ |
| 1404 | 123, |
| 1405 | []interface{}{"456", 789}, |
| 1406 | map[string]interface{}{ |
| 1407 | "a": "b", |
| 1408 | }, |
| 1409 | }, |
| 1410 | index: 1, |
| 1411 | value: []interface{}{"456", 789}, |
| 1412 | wantHasValue: success, |
| 1413 | wantNotHasValue: failure, |
| 1414 | }, |
| 1415 | { |
| 1416 | name: "index two check", |
| 1417 | array: []interface{}{ |
| 1418 | 123, |
| 1419 | []interface{}{"456", 789}, |
| 1420 | map[string]interface{}{ |
| 1421 | "a": "b", |
| 1422 | }, |
| 1423 | }, |
| 1424 | index: 2, |
| 1425 | value: map[string]interface{}{"a": "b"}, |
| 1426 | wantHasValue: success, |
| 1427 | wantNotHasValue: failure, |
| 1428 | }, |
| 1429 | { |
| 1430 | name: "out of bounds check", |
| 1431 | array: []interface{}{ |
| 1432 | 123, |
| 1433 | []interface{}{"456", 789}, |
| 1434 | map[string]interface{}{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…