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.4 by root, Sat May 3 12:17:35 2008 UTC vs.
Revision 1.6 by root, Sat May 24 23:10:18 2008 UTC

1#!perl 1#!perl
2 2
3use strict; 3use strict;
4
4use AnyEvent::Impl::Perl; 5use AnyEvent::Impl::Perl;
5use AnyEvent::Handle; 6use AnyEvent::Handle;
6use Test::More tests => 3; 7use Test::More tests => 4;
7use Socket; 8use Socket;
8 9
9{ 10{
10 my $cv = AnyEvent->condvar; 11 my $cv = AnyEvent->condvar;
11 12
44 my $rd_ae = 45 my $rd_ae =
45 AnyEvent::Handle->new ( 46 AnyEvent::Handle->new (
46 fh => $rd, 47 fh => $rd,
47 on_eof => sub { $cv->broadcast }, 48 on_eof => sub { $cv->broadcast },
48 on_read => sub { 49 on_read => sub {
49 $_[0]->push_read_line (sub { 50 $_[0]->push_read (line => sub {
50 $concat .= "$_[1]:"; 51 $concat .= "$_[1]:";
51 }); 52 });
52 } 53 }
53 ); 54 );
54 55
55 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 };
56 57
58 $wr_ae->push_write (netstring => "0:xx,,");
57 $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");
58 undef $wr; 60 undef $wr;
59 undef $wr_ae; 61 undef $wr_ae;
62
63 $rd_ae->push_read (netstring => sub {
64 is ($_[1], "0:xx,,");
65 });
60 66
61 $cv->wait; 67 $cv->wait;
62 68
63 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');
64} 70}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines