1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | $| = 1; |
3 | $| = 1; |
4 | |
4 | |
5 | BEGIN { |
5 | BEGIN { |
6 | print "1..31\n"; |
6 | print "1..37\n"; |
7 | print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; |
7 | print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n"; |
8 | } |
8 | } |
9 | use AnyEvent; |
9 | use AnyEvent; |
10 | use AnyEvent::IO qw(:DEFAULT :flags); |
10 | use AnyEvent::IO qw(:DEFAULT :flags); |
11 | BEGIN { |
11 | BEGIN { |
… | |
… | |
14 | |
14 | |
15 | our $t = 3; |
15 | our $t = 3; |
16 | |
16 | |
17 | sub t { |
17 | sub t { |
18 | my $ok = shift; |
18 | my $ok = shift; |
19 | my $f = "ae_" . shift; |
19 | my $f = "io_" . shift; |
20 | $f->(@_, my $cv = AE::cv); |
20 | $f->(@_, my $cv = AE::cv); |
21 | my @res = $cv->recv; |
21 | my @res = $cv->recv; |
22 | |
22 | |
23 | print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; |
23 | print !@res != !$ok ? "not " : "", "ok ", $t++, " # $f (@_) = (@res)\n"; |
24 | |
24 | |
… | |
… | |
38 | my $fh = t 1, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; |
38 | my $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; |
39 | t 0, open => "$DIR/test", O_CREAT | O_EXCL | O_WRONLY, 0666; |
40 | |
40 | |
41 | t 0, rmdir => $DIR; |
41 | t 0, rmdir => $DIR; |
42 | |
42 | |
43 | t 1, write => $fh, "test1"; |
43 | t 1, write => $fh, "tes--"; |
44 | t 1, write => $fh, "test2"; |
44 | t 1, write => $fh, "test2"; |
45 | t 1, write => $fh, ""; |
45 | t 1, write => $fh, ""; |
|
|
46 | |
|
|
47 | t 1, seek => $fh, 3, 0; |
|
|
48 | t 1, write => $fh, "t1"; |
46 | |
49 | |
47 | t 1, stat => $fh; |
50 | t 1, stat => $fh; |
48 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; |
51 | print -s _ != 10 ? "not " : "", "ok ", $t++, " # stat size\n"; |
49 | |
52 | |
50 | t 1, close => $fh; |
53 | t 1, close => $fh; |