| 1608 | } |
| 1609 | |
| 1610 | func 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 | |
| 1644 | func TestArray_Every(t *testing.T) { |
| 1645 | t.Run("check value", func(t *testing.T) { |