… | |
… | |
2 | |
2 | |
3 | use strict; |
3 | use strict; |
4 | |
4 | |
5 | use AnyEvent::Impl::Perl; |
5 | use AnyEvent::Impl::Perl; |
6 | use AnyEvent::Handle; |
6 | use AnyEvent::Handle; |
7 | use Test::More tests => 7; |
7 | use Test::More tests => 8; |
8 | use Socket; |
8 | use Socket; |
9 | |
9 | |
10 | { |
10 | { |
11 | my $cv = AnyEvent->condvar; |
11 | my $cv = AnyEvent->condvar; |
12 | |
12 | |
… | |
… | |
61 | undef $wr; |
61 | undef $wr; |
62 | undef $rd; |
62 | undef $rd; |
63 | |
63 | |
64 | $wr_ae->push_write (netstring => "0:xx,,"); |
64 | $wr_ae->push_write (netstring => "0:xx,,"); |
65 | $wr_ae->push_write (netstring => ""); |
65 | $wr_ae->push_write (netstring => ""); |
66 | $wr_ae->push_write (packstring => "w", "hallole" x 99); |
66 | $wr_ae->push_write (storable => [4,3,2]); |
|
|
67 | $wr_ae->push_write (packstring => "w", "hallole" x 99999); # try to exhaust socket buffer here |
67 | $wr_ae->push_write ("A\nBC\nDEF\nG\n" . ("X" x 113) . "\n"); |
68 | $wr_ae->push_write ("A\012BC\012DEF\nG\012" . ("X" x 113) . "\012"); |
68 | undef $wr_ae; |
69 | undef $wr_ae; |
69 | |
70 | |
70 | $rd_ae->push_read (netstring => sub { is ($_[1], "0:xx,,"); }); |
71 | $rd_ae->push_read (netstring => sub { is ($_[1], "0:xx,,") }); |
71 | $rd_ae->push_read (netstring => sub { is ($_[1], ""); }); |
72 | $rd_ae->push_read (netstring => sub { is ($_[1], "") }); |
|
|
73 | $rd_ae->push_read (storable => "w", sub { is ("@{$_[1]}", "4 3 2") }); |
72 | $rd_ae->push_read (packstring => "w", sub { is ($_[1], "hallole" x 99); }); |
74 | $rd_ae->push_read (packstring => "w", sub { is ($_[1], "hallole" x 99999) }); |
73 | |
75 | |
74 | $cv->wait; |
76 | $cv->wait; |
75 | |
77 | |
76 | is ($concat, "A:BC:DEF:G:" . ("X" x 113) . ":", 'second lines were read correctly'); |
78 | is ($concat, "A:BC:DEF:G:" . ("X" x 113) . ":", 'second set of lines were read correctly'); |
77 | } |
79 | } |
78 | |
80 | |