1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | $| = 1; |
3 | $| = 1; |
4 | |
4 | |
5 | BEGIN { |
5 | BEGIN { |
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 | } |
9 | use AnyEvent; |
9 | use AnyEvent; |
10 | use AnyEvent::IO qw(:DEFAULT :flags); |
10 | use AnyEvent::IO qw(:DEFAULT :flags); |
11 | BEGIN { |
11 | BEGIN { |
… | |
… | |
13 | } |
13 | } |
14 | |
14 | |
15 | our $t = 3; |
15 | our $t = 3; |
16 | |
16 | |
17 | sub t { |
17 | sub 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 | |
… | |
… | |
59 | t 1, rename => "$DIR/test", "$DIR/test2"; |
58 | t 1, rename => "$DIR/test", "$DIR/test2"; |
60 | |
59 | |
61 | ############################################################################# |
60 | ############################################################################# |
62 | # test file |
61 | # test file |
63 | |
62 | |
64 | my $fh = t 1, open => "$DIR/test2", O_RDONLY, 0; |
63 | $fh = t 1, open => "$DIR/test2", O_RDONLY, 0; |
65 | |
64 | |
66 | print +(t 1, read => $fh, 6) ne "test1t" ? "not " : "", "ok ", $t++, " # read 6\n"; |
65 | print +(t 1, read => $fh, 6) ne "test1t" ? "not " : "", "ok ", $t++, " # read 6\n"; |
67 | print +(t 1, read => $fh, 7) ne "est2" ? "not " : "", "ok ", $t++, " # read 7\n"; |
66 | print +(t 1, read => $fh, 7) ne "est2" ? "not " : "", "ok ", $t++, " # read 7\n"; |
68 | print +(t 1, read => $fh, 8) ne "" ? "not " : "", "ok ", $t++, " # read 8\n"; |
67 | print +(t 1, read => $fh, 8) ne "" ? "not " : "", "ok ", $t++, " # read 8\n"; |
69 | |
68 | |