File-Raw

 view release on metacpan or  search on metacpan

t/002-file-callbacks.t  view on Meta::CPAN

    is($collected[2], '', 'empty line preserved');
    is($collected[5], '# this is a comment', 'comment line preserved');
};

subtest 'each_line empty file' => sub {
    my $empty = "$tmpdir/empty.txt";
    File::Raw::spew($empty, "");

    my $count = 0;
    File::Raw::each_line($empty, sub { $count++ });
    is($count, 0, 'no iterations for empty file');
};

subtest 'each_line nonexistent file' => sub {
    my @collected;
    File::Raw::each_line("$tmpdir/nonexistent.txt", sub {
        push @collected, $_;
    });
    is(scalar(@collected), 0, 'no lines from nonexistent file');
};



( run in 1.969 second using v1.01-cache-2.11-cpan-71847e10f99 )