MCPcopy Create free account
hub / github.com/jmespath/go-jmespath / Test_includeElement

Function Test_includeElement

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

Source from the content-addressed store, hash-verified

687}
688
689func Test_includeElement(t *testing.T) {
690
691 list1 := []string{"Foo", "Bar"}
692 list2 := []int{1, 2}
693 simpleMap := map[interface{}]interface{}{"Foo": "Bar"}
694
695 ok, found := includeElement("Hello World", "World")
696 True(t, ok)
697 True(t, found)
698
699 ok, found = includeElement(list1, "Foo")
700 True(t, ok)
701 True(t, found)
702
703 ok, found = includeElement(list1, "Bar")
704 True(t, ok)
705 True(t, found)
706
707 ok, found = includeElement(list2, 1)
708 True(t, ok)
709 True(t, found)
710
711 ok, found = includeElement(list2, 2)
712 True(t, ok)
713 True(t, found)
714
715 ok, found = includeElement(list1, "Foo!")
716 True(t, ok)
717 False(t, found)
718
719 ok, found = includeElement(list2, 3)
720 True(t, ok)
721 False(t, found)
722
723 ok, found = includeElement(list2, "1")
724 True(t, ok)
725 False(t, found)
726
727 ok, found = includeElement(simpleMap, "Foo")
728 True(t, ok)
729 True(t, found)
730
731 ok, found = includeElement(simpleMap, "Bar")
732 True(t, ok)
733 False(t, found)
734
735 ok, found = includeElement(1433, "1")
736 False(t, ok)
737 False(t, found)
738}
739
740func TestElementsMatch(t *testing.T) {
741 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 3

includeElementFunction · 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…