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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/usr/bin/perl
use strict;
use warnings;
use File::Spec;
use Test::More tests => 2;
use IO::All;
my $t = -e 't' ? 't' : 'test';
my $fn = File::Spec->catfile(File::Spec->curdir, $t, 'data', 'head_test.txt');
{
# See: https://github.com/ingydotnet/io-all-pm/issues/44
# TEST
is_deeply(
[io->file($fn)->chomp->head()],
[qw(
1
2
0
3
4
5
6
7
8
9
)
],
"Read the first 10 lines with chomp (should not stop at 0).",
);
# TEST
is_deeply(
[io->file($fn)->chomp->head(5)],
[qw(
1
2
0
3
4
)
],
"Read the first 5 lines.",
);
}
|