File: iappend.t

package info (click to toggle)
libiterator-util-perl 0.02%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 132 kB
  • sloc: perl: 234; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 659 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use Test::More tests => 2;
use Iterator::Util;

# Check that iappend works as promised.

sub begins_with
{
    my ($actual, $expected, $test_name) = @_;

    $actual = substr($actual, 0, length $expected);
    @_ =  ($actual, $expected, $test_name);
    goto &is;
}

my ($iter, @vals);

# iappend (2)
eval
{
    my $it1 = irange 1,3;
    my $it2 = irange 20,30,8;
    my $it3 = irange 110, 100, -5;
    $iter = iappend $it1, $it2, $it3;

    push @vals, $iter->value  while $iter->isnt_exhausted;
};

is $@, q{},   q{Created iappend iterator, no errors};
is_deeply (\@vals, [1, 2, 3, 20, 28, 110, 105, 100], q{iappend returned expected values});