14 # First we create a file
15 open(F, ">file-$$") or die;
19 copy "file-$$", "copy-$$";
21 open(F, "copy-$$") or die;
25 print "not " if -s "file-$$" != -s "copy-$$";
28 print "not " unless $foo eq "ok 3\n";
31 copy "copy-$$", \*STDOUT;
32 unlink "copy-$$" or die "unlink: $!";
36 open(R, "copy-$$") or die "open copy-$$: $!"; $foo = <R>; close(R);
37 print "not " unless $foo eq "ok 3\n";
39 unlink "copy-$$" or die "unlink: $!";
42 close(F) or die "close: $!";
43 open(R, "copy-$$") or die; $foo = <R>; close(R) or die "close: $!";
44 print "not " unless $foo eq "ok 3\n";
46 unlink "copy-$$" or die "unlink: $!";
49 $fh = IO::File->new(">copy-$$") or die "Cannot open copy-$$:$!";
52 $fh->close or die "close: $!";
53 open(R, "copy-$$") or die; $foo = <R>; close(R);
54 print "# foo=`$foo'\nnot " unless $foo eq "ok 3\n";
56 unlink "copy-$$" or die "unlink: $!";
58 my $fh = FileHandle->new(">copy-$$") or die "Cannot open copy-$$:$!";
62 open(R, "copy-$$") or die; $foo = <R>; close(R);
63 print "not " unless $foo eq "ok 3\n";
65 unlink "file-$$" or die "unlink: $!";
67 print "# moved missing file.\nnot " if move("file-$$", "copy-$$");
68 print "# target disappeared.\nnot " if not -e "copy-$$";
71 move "copy-$$", "file-$$" or print "# move did not succeed.\n";
72 print "# not moved: $!\nnot " unless -e "file-$$" and not -e "copy-$$";
73 open(R, "file-$$") or die; $foo = <R>; close(R);
74 print "# foo=`$foo'\nnot " unless $foo eq "ok 3\n";
77 copy "file-$$", "lib";
78 open(R, "lib/file-$$") or die; $foo = <R>; close(R);
79 print "not " unless $foo eq "ok 3\n";
81 unlink "lib/file-$$" or die "unlink: $!";
83 move "file-$$", "lib";
84 open(R, "lib/file-$$") or die "open lib/file-$$: $!"; $foo = <R>; close(R);
85 print "not " unless $foo eq "ok 3\n" and not -e "file-$$";;
87 unlink "lib/file-$$" or die "unlink: $!";