X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2Ffilehand.t;h=827410a96aa701990e3faf8415246b14630434ee;hb=20822f61cc01ab34be1e17db483aceb9d5ec8fb7;hp=038a73cdd755ad4063949ff9b3472f07f6aee0db;hpb=36477c247f3c188fb8cc7e276c87b739d3e6ab7c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/lib/filehand.t b/t/lib/filehand.t index 038a73c..827410a 100755 --- a/t/lib/filehand.t +++ b/t/lib/filehand.t @@ -22,14 +22,16 @@ print "1..11\n"; print $mystdout "ok ",fileno($mystdout),"\n"; -$fh = new FileHandle "TEST", O_RDONLY and print "ok 2\n"; +$fh = (new FileHandle "./TEST", O_RDONLY + or new FileHandle "TEST", O_RDONLY) + and print "ok 2\n"; $buffer = <$fh>; print $buffer eq "#!./perl\n" ? "ok 3\n" : "not ok 3\n"; -ungetc $fh 65; +ungetc $fh ord 'A'; CORE::read($fh, $buf,1); print $buf eq 'A' ? "ok 4\n" : "not ok 4\n"; @@ -41,7 +43,7 @@ print "not " unless ($fh->open("< TEST") && <$fh> eq $buffer); print "ok 5\n"; $fh->seek(0,0); -print "not " unless (<$fh> eq $buffer); +print "#possible mixed CRLF/LF in t/TEST\nnot " unless (<$fh> eq $buffer); print "ok 6\n"; $fh->seek(0,2); @@ -62,14 +64,28 @@ autoflush STDOUT 1; print "not " unless ($|); print "ok 10\n"; +if ($^O eq 'dos') +{ + printf("ok %d\n",11); + exit(0); +} + ($rd,$wr) = FileHandle::pipe; -if (fork) { - $wr->close; - print $rd->getline; +if ($^O eq 'VMS' || $^O eq 'os2' || $^O eq 'amigaos' || $^O eq 'MSWin32' || + $Config{d_fork} ne 'define') { + $wr->autoflush; + $wr->printf("ok %d\n",11); + print $rd->getline; } else { - $rd->close; - $wr->printf("ok %d\n",11); - exit(0); + if (fork) { + $wr->close; + print $rd->getline; + } + else { + $rd->close; + $wr->printf("ok %d\n",11); + exit(0); + } }