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.1 by root, Wed Mar 28 22:28:48 2012 UTC vs.
Revision 1.3 by root, Wed Mar 28 23:44:28 2012 UTC

1#! perl 1#! perl
2 2
3$| = 1; 3$| = 1;
4 4
5BEGIN { 5BEGIN {
6 print "1..24\n"; 6 print "1..31\n";
7 print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; 7 print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n";
8} 8}
9use AnyEvent; 9use AnyEvent;
10use AnyEvent::IO qw(:DEFAULT :flags); 10use AnyEvent::IO qw(:DEFAULT :flags);
11BEGIN { 11BEGIN {
13} 13}
14 14
15our $t = 3; 15our $t = 3;
16 16
17sub t { 17sub t {
18 my $cv = AE::cv;
19 my $ok = shift; 18 my $ok = shift;
20 my $f = "ae_" . shift; 19 my $f = "ae_" . shift;
21 $f->(@_, my $cv = AE::cv); 20 $f->(@_, my $cv = AE::cv);
22 my @res = $cv->recv; 21 my @res = $cv->recv;
23 22
57print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n"; 56print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n";
58 57
59t 1, rename => "$DIR/test", "$DIR/test2"; 58t 1, rename => "$DIR/test", "$DIR/test2";
60 59
61############################################################################# 60#############################################################################
61# test dir
62
63t 0, readdir => "$DIR/nonexistent";
64my $res = t 1, readdir => $DIR;
65print @$res != 1 ? "not " : "", "ok ", $t++, " # res count\n";
66print $res->[0] ne "test2" ? "not " : "", "ok ", $t++, " # res data (@$res)\n";
67
68#############################################################################
62# test file 69# test file
63 70
64my $fh = t 1, open => "$DIR/test2", O_RDONLY, 0; 71$fh = t 1, open => "$DIR/test2", O_RDONLY, 0;
65 72
66print +(t 1, read => $fh, 6) ne "test1t" ? "not " : "", "ok ", $t++, " # read 6\n"; 73print +(t 1, read => $fh, 6) ne "test1t" ? "not " : "", "ok ", $t++, " # read 6\n";
67print +(t 1, read => $fh, 7) ne "est2" ? "not " : "", "ok ", $t++, " # read 7\n"; 74print +(t 1, read => $fh, 7) ne "est2" ? "not " : "", "ok ", $t++, " # read 7\n";
68print +(t 1, read => $fh, 8) ne "" ? "not " : "", "ok ", $t++, " # read 8\n"; 75print +(t 1, read => $fh, 8) ne "" ? "not " : "", "ok ", $t++, " # read 8\n";
69 76

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines