ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/io_common
(Generate patch)

Comparing AnyEvent/t/io_common (file contents):
Revision 1.7 by root, Thu Apr 5 03:13:27 2012 UTC vs.
Revision 1.9 by root, Fri Apr 13 15:24:57 2012 UTC

3$| = 1; 3$| = 1;
4 4
5# not tested: symlink, readlink, link, utime, chown, chmod 5# not tested: symlink, readlink, link, utime, chown, chmod
6 6
7BEGIN { 7BEGIN {
8 print "1..38\n"; 8 print "1..37\n";
9 print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; 9 print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n";
10} 10}
11use AnyEvent; 11use AnyEvent;
12use AnyEvent::IO qw(:DEFAULT :flags); 12use AnyEvent::IO qw(:DEFAULT :flags);
13BEGIN { 13BEGIN {
25 print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; 25 print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n";
26 26
27 wantarray ? @res : $res[0] 27 wantarray ? @res : $res[0]
28} 28}
29 29
30our $TMP = "/tmp"; 30use File::Spec;
31
32our $TMP = File::Spec->tmpdir;
31our $DIR = "$TMP/ae_io_testdir_$$~"; 33our $DIR = "$TMP/ae_io_testdir_$$~";
32 34
33t 1, mkdir => $DIR, 0777 35t 1, mkdir => $DIR, 0777
34 or do { print "Bail out! Cannot mkdir $DIR, skipping test.\n"; exit 0 }; 36 or do { print "Bail out! Cannot mkdir $DIR, skipping test.\n"; exit 0 };
35t 0, mkdir => $DIR, 0777; 37t 0, mkdir => $DIR, 0777;
41 t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; 43 t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666;
42 44
43t 0, rmdir => $DIR; 45t 0, rmdir => $DIR;
44 46
45t 1, write => $fh, "tes--"; 47t 1, write => $fh, "tes--";
46t 1, write => $fh, "test2truncate"; 48t 1, write => $fh, "test2";
47t 1, write => $fh, ""; 49t 1, write => $fh, "";
48 50
49t 1, seek => $fh, 3, 0; 51t 1, seek => $fh, 3, 0;
50t 1, write => $fh, "t1"; 52t 1, write => $fh, "t1";
51 53
52t 1, truncate => $fh, 5+5; 54#t 1, truncate => $fh, 5+5; # not available on windows
53 55
54t 1, stat => $fh; 56t 1, stat => $fh;
55print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; 57print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n";
56 58
57t 1, close => $fh; 59t 1, close => $fh;
58 60
59t 1, stat => "$DIR/test"; 61t 1, stat => "$DIR/test";
60print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; 62print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size (", -s _,")\n";
61 63
62t 1, lstat => "$DIR/test"; 64t 1, lstat => "$DIR/test";
63print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n"; 65print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n";
64 66
65t 1, rename => "$DIR/test", "$DIR/test2"; 67t 1, rename => "$DIR/test", "$DIR/test2";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines