1N/A chdir 't' if -d 't'; 1N/A # First we create a file 1N/A binmode F; # for DOSISH platforms, because test 3 copies to stdout 1N/A print "not " if -s "file-$$" != -s "copy-$$"; 1N/A print "# foo=`$foo'\nnot " unless $foo eq sprintf "ok %d\n", 3+$loopconst; 1N/A printf "ok %d\n", 6+$loopconst; 1N/A unlink "copy-$$" or die "unlink: $!"; 1N/A my $fh = FileHandle->new(">copy-$$") or die "Cannot open copy-$$:$!"; 1N/A copy("file-$$",$fh); 1N/A open(R, "copy-$$") or die; $foo = <R>; close(R); 1N/A print "not " unless $foo eq sprintf "ok %d\n", 3+$loopconst; 1N/A printf "ok %d\n", 7+$loopconst; 1N/A unlink "file-$$" or die "unlink: $!"; 1N/A print "# moved missing file.\nnot " if move("file-$$", "copy-$$"); 1N/A print "# target disappeared.\nnot " if not -e "copy-$$"; 1N/A printf "ok %d\n", 8+$loopconst; 1N/A move "copy-$$", "file-$$" or print "# move did not succeed.\n"; 1N/A print "# not moved: $!\nnot " unless -e "file-$$" and not -e "copy-$$"; 1N/A open(R, "file-$$") or die; $foo = <R>; close(R); 1N/A if ($^O eq 'MacOS') { 1N/A unless (-e 'lib:') { # make sure there's no volume called 'lib' 1N/A eval { copy("copy-$$", "copy-$$") }; 1N/A eval { copy("copy-$$", "copy-$$") }; 1N/A print F "dummy content\n"; 1N/A eval { copy("file-$$", "symlink-$$") }; 1N/A print F "dummy content\n"; 1N/A eval { copy("file-$$", "hardlink-$$") };