X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdispatch_misc.t;h=90c90ed83ce8e2b23094f3094b7f73d63648d748;hb=refs%2Fheads%2Fpeople%2Fmattp%2Fplack-streaming;hp=0c11f2c117d4eb2e4a2e34ad3868c17b56cbaa0b;hpb=ca79c33d35dbc8259af2c9b2f522644fcc696439;p=catagits%2FWeb-Simple.git diff --git a/t/dispatch_misc.t b/t/dispatch_misc.t index 0c11f2c..90c90ed 100644 --- a/t/dispatch_misc.t +++ b/t/dispatch_misc.t @@ -22,6 +22,7 @@ sub run_request { $app->run_test_request( @_ ); } app_is_non_plack(); plack_app_return(); +plack_streaming_app_return(); broken_route_def(); array_with_sub(); array_with_no_sub(); @@ -68,6 +69,34 @@ sub plack_app_return { "when a route returns a thing that look like a Plack app, the web app redispatches to that thing"; } +sub plack_streaming_app_return { + { + + package FauxPlackStreamApp; + sub new { bless {}, $_[0] } + + sub to_app { + return sub { + return sub { + my $responder = shift; + $responder->([ 999, [], ["foo"] ]); + }; + }; + } + } + + @dispatch = ( + sub (/) { + FauxPlackStreamApp->new; + } + ); + + my $get = run_request( GET => 'http://localhost/' ); + + cmp_ok $get->code, '==', 999, + "when a route returns a thing that look like a Plack Streaming app, the web app redispatches to that thing"; +} + sub broken_route_def { @dispatch = ( '/' => "" );