This is an automated email from the git hooks/post-receive script. js pushed a commit to branch master in repository libplack-test-anyevent-perl.
commit b409ef954ff766a343c25e6bf076e828b1a1490a Author: Rob Hoelz <r...@hoelz.ro> Date: Mon Jan 26 09:56:44 2015 -0600 Move 3-length array response test into test class That way, it fits in with the other tests, and will be tested across various backends --- t/05-three-length-array-to-responder.t | 52 ---------------------------------- t/lib/Plack/Test/AnyEvent/Test.pm | 26 +++++++++++++++++ 2 files changed, 26 insertions(+), 52 deletions(-) diff --git a/t/05-three-length-array-to-responder.t b/t/05-three-length-array-to-responder.t deleted file mode 100644 index 2b58e43..0000000 --- a/t/05-three-length-array-to-responder.t +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use Test::More tests => 5; - -use Plack::Test; -$Plack::Test::Impl = 'AnyEvent'; - -use AnyEvent; -use HTTP::Request::Common; - - -my $app = sub { - my ( $env ) = @_; - - sub{ - my $responder = shift; - if($env->{QUERY_STRING} =~ /3-length/) { - $responder->([200, ['Content-Type' => 'text/plain'], ['ok']]); - } else { - my $writer = $responder->([200, ['Content-Type' => 'text/plain']]); - $writer->write('ok'); - $writer->close(); - } - } -}; - -test_psgi $app, sub{ - my ( $cb ) = @_; - - my $num_callbacks_invoked = 0; - - my $res = $cb->(GET '/'); - $res->on_content_received(sub { - $num_callbacks_invoked++; - is $res->code, 200; - is $res->content, 'ok'; - }); - $res->recv; - - my $res = $cb->(GET '/?3-length'); - $res->on_content_received(sub{ - $num_callbacks_invoked++; - is $res->code, 200; - is $res->content, 'ok'; - }); - $res->recv; - - is $num_callbacks_invoked, 2, 'make sure that both callbacks have been invoked'; -}; - -done_testing; diff --git a/t/lib/Plack/Test/AnyEvent/Test.pm b/t/lib/Plack/Test/AnyEvent/Test.pm index c831024..c2ff271 100644 --- a/t/lib/Plack/Test/AnyEvent/Test.pm +++ b/t/lib/Plack/Test/AnyEvent/Test.pm @@ -528,4 +528,30 @@ sub test_infinite_request_shutdown :Test { }; } +sub test_three_element_delayed_response :Test(3) { + my $app = sub { + return sub { + my ( $respond ) = @_; + + $respond->([ + 200, + [ 'Content-Type' => 'text/plain' ], + ['OK'] + ]); + }; + }; + + test_psgi $app, sub { + my ( $cb ) = @_; + + my $res = $cb->(GET '/'); + $res->on_content_received(sub{ + is $res->code, 200, 'Status code should match'; + is $res->content_type, 'text/plain', 'Content-Type header should match'; + is $res->content, 'OK', 'Content should match'; + }); + $res->recv; + }; +} + 1; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libplack-test-anyevent-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits