diff --git a/lib/modules/testsuite.in b/lib/modules/testsuite.in index ada820a4e2d21c78925442303ed9ccf1638d63d5..a24b99be3494a6ade3b27262d0ed0ffa9bc74a74 100644 --- a/lib/modules/testsuite.in +++ b/lib/modules/testsuite.in @@ -832,6 +832,8 @@ test_equal(Array.common_prefix(({ "labyrinth"/1, "diatom"/1 })), ({})) test_equal(Array.common_prefix(({ "abc"/1, "abc"/1, "abc"/1 })), "abc"/1) test_equal(Array.common_prefix(({})), ({})) +test_eq( sizeof(Array.Iterator(({1,2,3,4}))), 4 ) + dnl - Colors define(test_rgb,[[ @@ -1167,7 +1169,8 @@ test_eq( Int.swap_long(array_sscanf("\1\2\3\4", "%4c")[0]), dnl - Mapping dnl Mapping.delete -dnl Mapping.Iterator + +test_eq( sizeof(Mapping.Iterator(([1:2,3:4]))), 2 ) test_do([[ // Test for [bug 5085]. @@ -1178,7 +1181,8 @@ test_do([[ ]]) dnl - Multiset -dnl Multiset.Iterator + +test_eq( sizeof(Multiset.Iterator((<1,2,3>))), 3 ) dnl - Process test_equal([[Process.split_quoted_string("test ")]],[[({"test"})]]) diff --git a/src/iterators.cmod b/src/iterators.cmod index d2e34ae9c06ee764173bcbec77d67c536cd5e83c..89e94b173932833d528af4adc723f9b871f42a4b 100644 --- a/src/iterators.cmod +++ b/src/iterators.cmod @@ -525,7 +525,8 @@ PIKECLASS array_iterator if (THIS->a) { push_int(THIS->a->size); } - push_undefined(); + else + push_undefined(); } PIKEFUN object `+(int steps) @@ -659,7 +660,8 @@ PIKECLASS multiset_iterator if (THIS->l) { push_int(THIS->l->msd->size); } - push_undefined(); + else + push_undefined(); } static struct object *li_copy (struct multiset_iterator_struct *li) @@ -874,7 +876,8 @@ PIKECLASS string_iterator if (THIS->s) { push_int(THIS->s->len); } - push_undefined(); + else + push_undefined(); } PIKEFUN object `+(int steps)