--- AnyEvent/t/io_common 2012/03/28 22:28:48 1.1 +++ AnyEvent/t/io_common 2012/04/13 08:34:08 1.8 @@ -2,8 +2,10 @@ $| = 1; +# not tested: symlink, readlink, link, utime, chown, chmod + BEGIN { - print "1..24\n"; + print "1..37\n"; print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; } use AnyEvent; @@ -15,9 +17,8 @@ our $t = 3; sub t { - my $cv = AE::cv; my $ok = shift; - my $f = "ae_" . shift; + my $f = "aio_" . shift; $f->(@_, my $cv = AE::cv); my @res = $cv->recv; @@ -41,17 +42,22 @@ t 0, rmdir => $DIR; -t 1, write => $fh, "test1"; +t 1, write => $fh, "tes--"; t 1, write => $fh, "test2"; t 1, write => $fh, ""; +t 1, seek => $fh, 3, 0; +t 1, write => $fh, "t1"; + +#t 1, truncate => $fh, 5+5; # not available on windows + t 1, stat => $fh; print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; t 1, close => $fh; t 1, stat => "$DIR/test"; -print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; +print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size (", -s _,")\n"; t 1, lstat => "$DIR/test"; print -s _ != 10 ? "not " : "", "ok ", $t++, " # lstat size\n"; @@ -59,9 +65,17 @@ t 1, rename => "$DIR/test", "$DIR/test2"; ############################################################################# +# test dir + +t 0, readdir => "$DIR/nonexistent"; +my $res = t 1, readdir => $DIR; +print @$res != 1 ? "not " : "", "ok ", $t++, " # res count\n"; +print $res->[0] ne "test2" ? "not " : "", "ok ", $t++, " # res data (@$res)\n"; + +############################################################################# # test file -my $fh = t 1, open => "$DIR/test2", O_RDONLY, 0; +$fh = t 1, open => "$DIR/test2", O_RDONLY, 0; print +(t 1, read => $fh, 6) ne "test1t" ? "not " : "", "ok ", $t++, " # read 6\n"; print +(t 1, read => $fh, 7) ne "est2" ? "not " : "", "ok ", $t++, " # read 7\n";