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.3 by root, Wed Mar 28 23:44:28 2012 UTC vs.
Revision 1.8 by root, Fri Apr 13 08:34:08 2012 UTC

1#! perl 1#! perl
2 2
3$| = 1; 3$| = 1;
4 4
5# not tested: symlink, readlink, link, utime, chown, chmod
6
5BEGIN { 7BEGIN {
6 print "1..31\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}
9use AnyEvent; 11use AnyEvent;
10use AnyEvent::IO qw(:DEFAULT :flags); 12use AnyEvent::IO qw(:DEFAULT :flags);
11BEGIN { 13BEGIN {
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 = "ae_" . 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
38my $fh = t 1, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; 40my $fh = t 1, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666;
39 t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; 41 t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666;
40 42
41t 0, rmdir => $DIR; 43t 0, rmdir => $DIR;
42 44
43t 1, write => $fh, "test1"; 45t 1, write => $fh, "tes--";
44t 1, write => $fh, "test2"; 46t 1, write => $fh, "test2";
45t 1, write => $fh, ""; 47t 1, write => $fh, "";
48
49t 1, seek => $fh, 3, 0;
50t 1, write => $fh, "t1";
51
52#t 1, truncate => $fh, 5+5; # not available on windows
46 53
47t 1, stat => $fh; 54t 1, stat => $fh;
48print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; 55print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n";
49 56
50t 1, close => $fh; 57t 1, close => $fh;
51 58
52t 1, stat => "$DIR/test"; 59t 1, stat => "$DIR/test";
53print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; 60print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size (", -s _,")\n";
54 61
55t 1, lstat => "$DIR/test"; 62t 1, lstat => "$DIR/test";
56print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n"; 63print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n";
57 64
58t 1, rename => "$DIR/test", "$DIR/test2"; 65t 1, rename => "$DIR/test", "$DIR/test2";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines