cvs commit: modperl-2.0/t/response/TestAPR perlio.pm
stas2002/06/21 08:45:06 Modified:t/response/TestAPR perlio.pm Log: only a comments fixes Revision ChangesPath 1.12 +2 -2 modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- perlio.pm 21 Jun 2002 15:28:43 - 1.11 +++ perlio.pm 21 Jun 2002 15:45:06 - 1.12 -12,8 +12,8 use Apache::Const -compile = 'OK'; use constant HAVE_PERLIO = eval { require APR::PerlIO }; -#XXX: feel free to enable if largefile support is not enabled in Perl #XXX: APR::LARGE_FILES_CONFLICT constant? +#XXX: you can set to zero if largefile support is not enabled in Perl use constant LARGE_FILES_CONFLICT = 1; sub handler { -197,7 +197,7 # buffer up $oldfh = select($wfh); $| = 0; select($oldfh); -print $wfh $expected; # must be flushed to disk immediately +print $wfh $expected; # should be buffered up and not flushed ok t_cmp(undef, scalar($rfh),
cvs commit: modperl-2.0/t/response/TestAPR perlio.pm
stas2002/06/15 12:08:21 Modified:t/response/TestAPR perlio.pm Log: disable the failing tests with 5.8.0-RC2 while reworking APR PerlIO layer Revision ChangesPath 1.9 +1 -1 modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- perlio.pm 31 May 2002 02:19:11 - 1.8 +++ perlio.pm 15 Jun 2002 19:08:21 - 1.9 -27,7 +27,7 #$tests += $lfs_tests if USE_LARGE_FILES; #XXX -plan $r, tests = $tests, have_perl 'iolayers'; +plan $r, tests = $tests, todo = [5,8], have_perl 'iolayers'; my $vars = Apache::Test::config()-{vars}; my $dir = catfile $vars-{documentroot}, perlio;
cvs commit: modperl-2.0/t/response/TestAPR perlio.pm
dougm 2002/06/15 16:48:58 Modified:t/response/TestAPR perlio.pm Log: disabling tests until perlio issues are sorted out Revision ChangesPath 1.10 +3 -3 modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- perlio.pm 15 Jun 2002 19:08:21 - 1.9 +++ perlio.pm 15 Jun 2002 23:48:58 - 1.10 -22,12 +22,12 return Apache::OK; } -my $tests = 11; +my $tests = 2; #XXX 11; my $lfs_tests = 3; #$tests += $lfs_tests if USE_LARGE_FILES; #XXX -plan $r, tests = $tests, todo = [5,8], have_perl 'iolayers'; +plan $r, tests = $tests, have_perl 'iolayers'; my $vars = Apache::Test::config()-{vars}; my $dir = catfile $vars-{documentroot}, perlio; -66,7 +66,7 expected failure); } } - +return Apache::OK; #XXX remove when perlio issues are sorted out # seek/tell() tests #XXX: feel free to enable if largefile support is not enabled in Perl if (0) {
cvs commit: modperl-2.0/t/response/TestAPR perlio.pm
stas02/01/04 01:30:45 Modified:t/response/TestAPR perlio.pm Log: + extend PerlIO tests + cleanups Revision ChangesPath 1.6 +92 -28modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- perlio.pm 18 Dec 2001 06:02:29 - 1.5 +++ perlio.pm 4 Jan 2002 09:30:45 - 1.6 @@ -23,74 +23,116 @@ return Apache::OK; } -plan $r, tests = 9, have_perl 'iolayers'; +plan $r, tests = 14, have_perl 'iolayers'; my $vars = Apache::Test::config()-{vars}; my $dir = catfile $vars-{documentroot}, perlio; t_mkdir($dir); +my $sep = -- sep --\n; +my @lines = (This is a test: $$\n, test line --sep two\n); +my $expected = $lines[0]; +my $expected_all = join $sep, @lines; + # write file my $file = catfile $dir, test; -t_debug open file $file; +t_debug open file $file for writing; my $foo = bar; open my $fh, :APR, $file, $r or die Cannot open $file for writing: $!; ok ref($fh) eq 'GLOB'; -my $expected = This is a test: $$; -t_debug write to a file: $expected; -print $fh $expected; +t_debug write to a file:\n$expected; +print $fh $expected_all; close $fh; -# open() other tests +# open() failure test { # non-existant file my $file = /this/file/does/not/exist; -t_write_file(/tmp/testing, some stuff); if (open my $fh, :APR, $file, $r) { t_debug must not be able to open $file!; ok 0; close $fh; } else { -t_debug good! cannot open/doesn't exist: $!; -ok 1; +ok t_cmp('No such file or directory', + $!, + expected failure); } } -# read() test -{ -open my $fh, :APR, $file, $r -or die Cannot open $file for reading: $!; -ok ref($fh) eq 'GLOB'; - -my $received = $fh; -close $fh; - -ok t_cmp($expected, - $received, - read/write file); -} - # seek/tell() tests { open my $fh, :APR, $file, $r or die Cannot open $file for reading: $!; -my $pos = 3; -seek $fh, $pos, Fcntl::SEEK_SET(); +# read the whole file so we can test the buffer flushed +# correctly on seek. +my $dummy = join '', $fh; +# Fcntl::SEEK_SET() +my $pos = 3; # rewinds after reading 6 chars above +seek $fh, $pos, Fcntl::SEEK_SET(); my $got = tell($fh); ok t_cmp($pos, $got, - seek/tell the file); + seek/tell the file Fcntl::SEEK_SET); + +# Fcntl::SEEK_CUR() +my $step = 10; +$pos = tell($fh) + $step; +seek $fh, $step, Fcntl::SEEK_CUR(); +$got = tell($fh); +ok t_cmp($pos, + $got, + seek/tell the file Fcntl::SEEK_CUR); + +# Fcntl::SEEK_END() +$pos = -s $file; +seek $fh, 0, Fcntl::SEEK_END(); +$got = tell($fh); +ok t_cmp($pos, + $got, + seek/tell the file Fcntl::SEEK_END); -# XXX: test Fcntl::SEEK_CUR() Fcntl::SEEK_END() close $fh; +} + +# read() tests +{ +open my $fh, :APR, $file, $r +or die Cannot open $file for reading: $!; +# basic open test +ok ref($fh) eq 'GLOB'; + +# basic single line read +ok t_cmp($expected, + scalar($fh), + single line read); + +# slurp mode +seek $fh, 0, Fcntl::SEEK_SET(); # rewind to the start +local $/; +ok t_cmp($expected_all, + scalar($fh), + slurp file); + +# test ungetc (a long sep requires read ahead) +seek $fh, 0, Fcntl::SEEK_SET(); # rewind to the start +local $/ = $sep; +my @got_lines = $fh; +my @expect = ($lines[0] . $sep, $lines[1]); +ok t_cmp(\@expect, + \@got_lines, + adjusted input record sep read); + +close $fh; } + # eof() tests { open my $fh, :APR, $file, $r @@ -103,6 +145,7 @@ seek $fh, 0, Fcntl::SEEK_END(); my $received = $fh; +t_debug($received); ok t_cmp(1, eof($fh), end of
cvs commit: modperl-2.0/t/response/TestAPR perlio.pm
dougm 01/12/17 16:43:37 Modified:t/response/TestAPR perlio.pm Log: we do want have_perl iolayers in the plan for 5.6.1 Revision ChangesPath 1.3 +1 -1 modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- perlio.pm 2001/12/18 00:36:22 1.2 +++ perlio.pm 2001/12/18 00:43:37 1.3 @@ -23,7 +23,7 @@ return Apache::OK; } -plan $r, tests = 9, todo = [5]; +plan $r, tests = 9, todo = [5], have_perl 'iolayers'; my $vars = Apache::Test::config()-{vars}; my $dir = catfile $vars-{documentroot}, perlio;
cvs commit: modperl-2.0/t/response/TestAPR perlio.pm
dougm 01/12/17 22:01:43 Modified:t/response/TestAPR perlio.pm Log: tell works now; remove todo Revision ChangesPath 1.4 +1 -1 modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- perlio.pm 2001/12/18 00:43:37 1.3 +++ perlio.pm 2001/12/18 06:01:43 1.4 @@ -23,7 +23,7 @@ return Apache::OK; } -plan $r, tests = 9, todo = [5], have_perl 'iolayers'; +plan $r, tests = 9, have_perl 'iolayers'; my $vars = Apache::Test::config()-{vars}; my $dir = catfile $vars-{documentroot}, perlio;
cvs commit: modperl-2.0/t/response/TestAPR perlio.pm
dougm 01/12/17 22:02:29 Modified:t/response/TestAPR perlio.pm Log: tell works now; XXX broken comment Revision ChangesPath 1.5 +1 -1 modperl-2.0/t/response/TestAPR/perlio.pm Index: perlio.pm === RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/perlio.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- perlio.pm 2001/12/18 06:01:43 1.4 +++ perlio.pm 2001/12/18 06:02:29 1.5 @@ -80,7 +80,7 @@ my $pos = 3; seek $fh, $pos, Fcntl::SEEK_SET(); -# XXX: broken + my $got = tell($fh); ok t_cmp($pos, $got,