MCPcopy Create free account
hub / github.com/gavv/httpexpect / TestArray_Iter

Function TestArray_Iter

array_test.go:1610–1642  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1608}
1609
1610func TestArray_Iter(t *testing.T) {
1611 t.Run("empty", func(t *testing.T) {
1612 reporter := newMockReporter(t)
1613
1614 data := []interface{}{}
1615
1616 value := NewArray(reporter, data)
1617
1618 it := value.Iter()
1619
1620 assert.NotNil(t, it)
1621 assert.Equal(t, 0, len(data), it)
1622
1623 value.chain.assert(t, success)
1624 })
1625
1626 t.Run("not empty", func(t *testing.T) {
1627 reporter := newMockReporter(t)
1628
1629 data := []interface{}{"foo", 123.0}
1630
1631 value := NewArray(reporter, data)
1632
1633 it := value.Iter()
1634
1635 assert.NotNil(t, it)
1636 assert.Equal(t, 2, len(it))
1637 assert.Equal(t, "foo", it[0].Raw())
1638 assert.Equal(t, 123.0, it[1].Raw())
1639
1640 value.chain.assert(t, success)
1641 })
1642}
1643
1644func TestArray_Every(t *testing.T) {
1645 t.Run("check value", func(t *testing.T) {

Callers

nothing calls this directly

Calls 6

IterMethod · 0.95
newMockReporterFunction · 0.85
NewArrayFunction · 0.85
assertMethod · 0.80
EqualMethod · 0.45
RawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…