ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/handle/01_readline.t
(Generate patch)

Comparing AnyEvent/t/handle/01_readline.t (file contents):
Revision 1.5 by root, Wed May 21 14:37:55 2008 UTC vs.
Revision 1.6 by root, Sat May 24 23:10:18 2008 UTC

2 2
3use strict; 3use strict;
4 4
5use AnyEvent::Impl::Perl; 5use AnyEvent::Impl::Perl;
6use AnyEvent::Handle; 6use AnyEvent::Handle;
7use Test::More tests => 3; 7use Test::More tests => 4;
8use Socket; 8use Socket;
9 9
10{ 10{
11 my $cv = AnyEvent->condvar; 11 my $cv = AnyEvent->condvar;
12 12
45 my $rd_ae = 45 my $rd_ae =
46 AnyEvent::Handle->new ( 46 AnyEvent::Handle->new (
47 fh => $rd, 47 fh => $rd,
48 on_eof => sub { $cv->broadcast }, 48 on_eof => sub { $cv->broadcast },
49 on_read => sub { 49 on_read => sub {
50 $_[0]->push_read_line (sub { 50 $_[0]->push_read (line => sub {
51 $concat .= "$_[1]:"; 51 $concat .= "$_[1]:";
52 }); 52 });
53 } 53 }
54 ); 54 );
55 55
56 my $wr_ae = new AnyEvent::Handle fh => $wr, on_eof => sub { die }; 56 my $wr_ae = new AnyEvent::Handle fh => $wr, on_eof => sub { die };
57 57
58 $wr_ae->push_write (netstring => "0:xx,,");
58 $wr_ae->push_write ("A\nBC\nDEF\nG\n" . ("X" x 113) . "\n"); 59 $wr_ae->push_write ("A\nBC\nDEF\nG\n" . ("X" x 113) . "\n");
59 undef $wr; 60 undef $wr;
60 undef $wr_ae; 61 undef $wr_ae;
62
63 $rd_ae->push_read (netstring => sub {
64 is ($_[1], "0:xx,,");
65 });
61 66
62 $cv->wait; 67 $cv->wait;
63 68
64 is ($concat, "A:BC:DEF:G:" . ("X" x 113) . ":", 'second lines were read correctly'); 69 is ($concat, "A:BC:DEF:G:" . ("X" x 113) . ":", 'second lines were read correctly');
65} 70}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines