Acme-InputRecordSeparatorIsRegexp
view release on metacpan or search on metacpan
MANIFEST This list of files
README
t/00-load.t
t/01-readline.t
t/02-readline.t
t/03-seektell.t
t/03b-seektell.t
t/04-longline.t
t/04b-longline.t
t/05-readwrite.t
t/06-DATA.t
t/06b-DATA.t
t/07-memory.t
t/07b-memory.t
t/08-chomp.t
t/08b-chomp.t
t/09-autochomp.t
t/09b-autochomp.t
t/10-input-record-separator.t
t/10b-input-record-separator.t
t/manifest.t
t/pod-coverage.t
lib/Acme/InputRecordSeparatorIsRegexp.pm view on Meta::CPAN
FILENO
BINMODE
OPEN
data sources
------------
regular file in < mode
piped input? socket?
regular file in <+ mode
regular file in >>+ mode
DATA filehandle
in memory filehandle
mock handle already tied to something else?
test data:
data with random, different line endings (\n, \r, \r\n)
random capital letters, split on ..., I dunno, [A-Z][XY]
join a sequence of integers, split on 120|12|345|
join a sequence of integers, split on 12|120|345|
t/06-DATA.t view on Meta::CPAN
if ($] < 5.010000) {
diag "readline on this package is sloooow for Perl $]. ",
"Skipping this set of tests which is a near duplicate of ",
"another set of tests.";
ok(1, "# skip $0 tests on Perl $]");
done_testing();
exit;
}
tie *DAT, 'Acme::InputRecordSeparatorIsRegexp', *DATA, '1.43|T.44|E...XD';
ok(tied(*DAT), 'return tied handle');
my (@tell, @seek);
push @tell, tell(DAT);
while (<DAT>) {
push @seek, $_;
push @tell, tell(DAT);
if (@seek > 1) {
ok( $seek[-2] =~ /1.43$/ || $seek[-2] =~ /T.44$/ ||
t/06-DATA.t view on Meta::CPAN
seek(DAT, $t, 0);
my $u = readline(DAT);
is( $u, $s, "seek to $t returns same result");
}
done_testing();
__DATA__
0:AAA1:AAB2:AAC3:AAD4:AAE5:AAF6:AAG7:AAH8:AAI9:AAJ10:AAK11:AAL12:AAM13:AAN14:AAO15:AAP16:AAQ17:AAR18:AAS19:AAT20:AAU21:AAV22:AAW23:AAX24:AAY25:AAZ26:ABA27:ABB28:ABC29:ABD30:ABE31:ABF32:ABG33:ABH34:ABI35:ABJ36:ABK37:ABL38:ABM39:ABN40:ABO41:ABP42:ABQ43...
t/06b-DATA.t view on Meta::CPAN
use Test::More;
use Acme::InputRecordSeparatorIsRegexp 'binmode';
use strict;
use warnings;
binmode *DATA, ":irs(1.43|T.44|E...XD)";
ok(tied(*DATA), 'return tied handle');
my (@tell, @seek);
push @tell, tell(DATA);
while (<DATA>) {
push @seek, $_;
push @tell, tell(DATA);
if (@seek > 1) {
ok( $seek[-2] =~ /1.43$/ || $seek[-2] =~ /T.44$/ ||
$seek[-2] =~ /E....XD$/, 'correct line ending' )
or diag $seek[-2], "\n\n", $seek[-1],
"\n\n", length($seek[-2]),"\t",length($seek[-1]);
}
}
# don't close
while (@seek) {
my ($s,$t);
my $i = int(rand(@seek));
$t = splice @tell, $i, 1;
$s = splice @seek, $i, 1;
seek(DATA, $t, 0);
my $u = readline(DATA);
is( $u, $s, "seek to $t returns same result");
}
done_testing();
__DATA__
0:AAA1:AAB2:AAC3:AAD4:AAE5:AAF6:AAG7:AAH8:AAI9:AAJ10:AAK11:AAL12:AAM13:AAN14:AAO15:AAP16:AAQ17:AAR18:AAS19:AAT20:AAU21:AAV22:AAW23:AAX24:AAY25:AAZ26:ABA27:ABB28:ABC29:ABD30:ABE31:ABF32:ABG33:ABH34:ABI35:ABJ36:ABK37:ABL38:ABM39:ABN40:ABO41:ABP42:ABQ43...
( run in 2.204 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )