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.6 by root, Wed Apr 4 02:18:30 2012 UTC vs.
Revision 1.9 by root, Fri Apr 13 15:24:57 2012 UTC

1#! perl 1#! perl
2 2
3$| = 1; 3$| = 1;
4
5# not tested: symlink, readlink, link, utime, chown, chmod
4 6
5BEGIN { 7BEGIN {
6 print "1..37\n"; 8 print "1..37\n";
7 print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; 9 print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n";
8} 10}
14 16
15our $t = 3; 17our $t = 3;
16 18
17sub t { 19sub t {
18 my $ok = shift; 20 my $ok = shift;
19 my $f = "io_" . shift; 21 my $f = "aio_" . shift;
20 $f->(@_, my $cv = AE::cv); 22 $f->(@_, my $cv = AE::cv);
21 my @res = $cv->recv; 23 my @res = $cv->recv;
22 24
23 print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; 25 print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n";
24 26
25 wantarray ? @res : $res[0] 27 wantarray ? @res : $res[0]
26} 28}
27 29
28our $TMP = "/tmp"; 30use File::Spec;
31
32our $TMP = File::Spec->tmpdir;
29our $DIR = "$TMP/ae_io_testdir_$$~"; 33our $DIR = "$TMP/ae_io_testdir_$$~";
30 34
31t 1, mkdir => $DIR, 0777 35t 1, mkdir => $DIR, 0777
32 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 };
33t 0, mkdir => $DIR, 0777; 37t 0, mkdir => $DIR, 0777;
45t 1, write => $fh, ""; 49t 1, write => $fh, "";
46 50
47t 1, seek => $fh, 3, 0; 51t 1, seek => $fh, 3, 0;
48t 1, write => $fh, "t1"; 52t 1, write => $fh, "t1";
49 53
54#t 1, truncate => $fh, 5+5; # not available on windows
55
50t 1, stat => $fh; 56t 1, stat => $fh;
51print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; 57print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n";
52 58
53t 1, close => $fh; 59t 1, close => $fh;
54 60
55t 1, stat => "$DIR/test"; 61t 1, stat => "$DIR/test";
56print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; 62print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size (", -s _,")\n";
57 63
58t 1, lstat => "$DIR/test"; 64t 1, lstat => "$DIR/test";
59print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n"; 65print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n";
60 66
61t 1, rename => "$DIR/test", "$DIR/test2"; 67t 1, rename => "$DIR/test", "$DIR/test2";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines