perl - Replacing for my $i ( 0, 1, 2 ) with something more stylish? -
i write perl tests in way
$i ( 0, 1, 2 ) { is_deeply( $fetch_public_topic_ids->[$i], $expected_sorted_topic_list->[$i], 'match' );
when $expected_sorted_topic
array ref test case data. feedback should avoid writing 0, 1, 2, 3... or 0...5 in "for", considered "bad style"?
but alternatives have instead?
you want iterate on indexes of array, no array figures in determining of index. problem hardcoding of indexes.
for $i (0..$#$fetch_public_topic_ids) { ... }
Comments
Post a Comment