diff options
Diffstat (limited to 't/lib')
-rwxr-xr-x | t/lib/filecopy.t | 51 | ||||
-rwxr-xr-x | t/lib/open2.t | 2 | ||||
-rwxr-xr-x | t/lib/open3.t | 2 |
3 files changed, 48 insertions, 7 deletions
diff --git a/t/lib/filecopy.t b/t/lib/filecopy.t index 8c64be1c98..0a5f4c180c 100755 --- a/t/lib/filecopy.t +++ b/t/lib/filecopy.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..5\n"; +print "1..11\n"; $| = 1; @@ -29,15 +29,56 @@ print "not " unless $foo eq "ok 3\n"; print "ok 2\n"; copy "copy-$$", \*STDOUT; +unlink "copy-$$"; +open(F,"file-$$"); +copy(*F, "copy-$$"); +open(R, "copy-$$") or die; $foo = <R>; close(R); +print "not " unless $foo eq "ok 3\n"; +print "ok 4\n"; +unlink "copy-$$"; +open(F,"file-$$"); +copy(\*F, "copy-$$"); +open(R, "copy-$$") or die; $foo = <R>; close(R); +print "not " unless $foo eq "ok 3\n"; +print "ok 5\n"; +unlink "copy-$$"; + +require IO::File; +$fh = IO::File->new(">copy-$$") or die "Cannot open copy-$$:$!"; +copy("file-$$",$fh); +$fh->close; +open(R, "copy-$$") or die; $foo = <R>; close(R); +print "not " unless $foo eq "ok 3\n"; +print "ok 6\n"; +unlink "copy-$$"; +require FileHandle; +my $fh = FileHandle->new(">copy-$$") or die "Cannot open copy-$$:$!"; +copy("file-$$",$fh); +$fh->close; +open(R, "copy-$$") or die; $foo = <R>; close(R); +print "not " unless $foo eq "ok 3\n"; +print "ok 7\n"; unlink "file-$$"; print "not " if move("file-$$", "copy-$$") or not -e "copy-$$"; -print "ok 4\n"; +print "ok 8\n"; move "copy-$$", "file-$$"; - print "not " unless -e "file-$$" and not -e "copy-$$"; -print "ok 5\n"; +open(R, "file-$$") or die; $foo = <R>; close(R); +print "not " unless $foo eq "ok 3\n"; +print "ok 9\n"; + +copy "file-$$", "lib"; +open(R, "lib/file-$$") or die; $foo = <R>; close(R); +print "not " unless $foo eq "ok 3\n"; +print "ok 10\n"; +unlink "lib/file-$$"; + +move "file-$$", "lib"; +open(R, "lib/file-$$") or die; $foo = <R>; close(R); +print "not " unless $foo eq "ok 3\n" and not -e "file-$$";; +print "ok 11\n"; +unlink "lib/file-$$"; -unlink "file-$$"; diff --git a/t/lib/open2.t b/t/lib/open2.t index 8dd786b76e..1cf325a875 100755 --- a/t/lib/open2.t +++ b/t/lib/open2.t @@ -1,5 +1,4 @@ #!./perl -w -use strict; BEGIN { chdir 't' if -d 't'; @@ -8,6 +7,7 @@ BEGIN { $SIG{__WARN__} = sub { die @_ }; } +use strict; use IO::Handle; use IPC::Open2; #require 'open2.pl'; use subs 'open2'; diff --git a/t/lib/open3.t b/t/lib/open3.t index a4a978ebea..a5d7f2e8ee 100755 --- a/t/lib/open3.t +++ b/t/lib/open3.t @@ -1,5 +1,4 @@ #!./perl -w -use strict; BEGIN { chdir 't' if -d 't'; @@ -8,6 +7,7 @@ BEGIN { $SIG{__WARN__} = sub { die @_ }; } +use strict; use IO::Handle; use IPC::Open3; #require 'open3.pl'; use subs 'open3'; |