Re: Proposed addition to File::Copy: move
[p5sagit/p5-mst-13.2.git] / t / lib / filecopy.t
1 #!./perl
2
3 BEGIN {
4     chdir 't' if -d 't';
5     @INC = '../lib';
6 }
7
8 print "1..5\n";
9
10 $| = 1;
11
12 use File::Copy;
13
14 # First we create a file
15 open(F, ">file-$$") or die;
16 print F "ok 3\n";
17 close F;
18
19 copy "file-$$", "copy-$$";
20
21 open(F, "copy-$$") or die;
22 $foo = <F>;
23 close(F);
24
25 print "not " if -s "file-$$" != -s "copy-$$";
26 print "ok 1\n";
27
28 print "not " unless $foo eq "ok 3\n";
29 print "ok 2\n";
30
31 copy "copy-$$", \*STDOUT;
32
33 unlink "file-$$";
34
35 print "not " if move("file-$$", "copy-$$") or not -e "copy-$$";
36 print "ok 4\n";
37
38 move "copy-$$", "file-$$";
39
40 print "not " unless -e "file-$$" and not -e "copy-$$";
41 print "ok 5\n";
42
43 unlink "file-$$";