Group
Extension

Matches 3

Iterator ( R/RO/ROODE/Iterator-0.03.tar.gz, ROODE, 2005; MetaCPAN )
Iterator/t/value.t ( view source; MetaCPAN )
rict;
use Test::More tests => 33;
use Iterator;

# Check that value() works.
# Also tests is_ and isnt_exhausted.

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

    $actual = substr
tor should not be exhausted already. (3)
eval
{
    $exh = $iter->is_exhausted;
    $nex = $iter->isnt_exhausted;
};

is ($@, q{}, q{Exhausted check didn't barf.});
ok (!$exh, q{Not exhausted yet.});
terator should not be exhausted yet. (3)
eval
{
    $exh = $iter->is_exhausted;
    $nex = $iter->isnt_exhausted;
};

is ($@, q{}, q{Exhausted check didn't barf.});
ok (!$exh, q{Not exhausted yet.});
Iterator ( R/RO/ROODE/Iterator-0.03.tar.gz, ROODE, 2005; MetaCPAN )
Iterator/t/new.t ( view source; MetaCPAN )
goto &is;
}

my ($iter, $x);

# New: too few (4)
eval
{
    $iter = Iterator->new();
};

$x = $@;
isnt $x, q{},   q{Too few parameters to new -> exception thrown};

ok (Iterator::X->caught(), q{Too-fe
oo};

# New: too many (4)
eval
{
    $iter = Iterator->new(sub {die}, 'whoa there');
};

$x = $@;
isnt $x, q{},   q{Too many parameters to new -> exception thrown};

ok (Iterator::X->caught(), q{Too-m
string, too};

# New: wrong type (4)
eval
{
    $iter = Iterator->new('whoa there');
};

$x = $@;
isnt $x, q{},   q{Wrong type of parameter to new -> exception thrown};

ok (Iterator::X->caught(), q{W
Iterator ( R/RO/ROODE/Iterator-0.03.tar.gz, ROODE, 2005; MetaCPAN )
Iterator/t/doc.t ( view source; MetaCPAN )
lues ok});

eval
{
    my $i = $it->value;     #  throws an Iterator::X::Exhausted exception.
};

isnt ($@, q{}, q{README iterator: exception thrown});
ok (Iterator::X->caught(), q{README exception: c
;

    @vals = ();
    eval
    {
        $another_it = upto (7, 10);
        while ($another_it->isnt_exhausted)
        {
            push @vals, $another_it->value;
        }
        # The above [p
other call to $another_it->value would throw an exception.
        $another_it->value
    };

    isnt ($@, q{}, q{$another_it iterator: exception thrown});
    ok (Iterator::X->caught(), q{$another_i

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.