Skip to content

Commit 08ee6fb

Browse files
committed
fix integer iterator test
Signed-off-by: Flipez <[email protected]>
1 parent f2eb41a commit 08ee6fb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

object/integer_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ func TestIntegerInspect(t *testing.T) {
5959

6060
func TestIntegerIteratable(t *testing.T) {
6161
int1 := object.NewInteger(3)
62+
int1Iterator := int1.GetIterator()
6263

6364
for expected := int64(0); expected < 3; expected++ {
64-
_, value, ok := int1.Next()
65+
_, value, ok := int1Iterator.Next()
6566
actual := value.(*object.Integer)
6667

6768
if !ok {
@@ -77,14 +78,14 @@ func TestIntegerIteratable(t *testing.T) {
7778
}
7879
}
7980

80-
_, _, ok := int1.Next()
81+
_, _, ok := int1Iterator.Next()
8182
if ok {
8283
t.Errorf("integer iteration didn't finish")
8384
}
8485

85-
int1.Reset()
86-
_, _, ok = int1.Next()
86+
int1Iterator = int1.GetIterator()
87+
_, _, ok = int1Iterator.Next()
8788
if !ok {
88-
t.Errorf("integer iteration shouldn't finish after reset")
89+
t.Errorf("new integer iteration shouldn't finish after first next")
8990
}
9091
}

0 commit comments

Comments
 (0)