From: Christian Walde Date: Fri, 22 Nov 2013 15:00:18 +0000 (+0100) Subject: add a test for trying to dispatch on a pair of WD::Matcher and non-sub X-Git-Tag: v0.021~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FWeb-Simple.git;a=commitdiff_plain;h=efbff59469fee6c705f12a22336c9a8e2b21abc5 add a test for trying to dispatch on a pair of WD::Matcher and non-sub --- diff --git a/t/dispatch_misc.t b/t/dispatch_misc.t index 3876e00..7ad4cd8 100644 --- a/t/dispatch_misc.t +++ b/t/dispatch_misc.t @@ -7,6 +7,7 @@ use Test::More; use HTTP::Request::Common qw(GET POST); use Web::Dispatch; use HTTP::Response; +use Web::Dispatch::Predicates 'match_true'; my @dispatch; @@ -27,6 +28,7 @@ invalid_psgi_responses(); middleware_as_only_route(); route_returns_middleware_plus_extra(); route_returns_undef(); +matcher_nonsub_pair(); done_testing(); @@ -145,3 +147,13 @@ sub route_returns_undef { cmp_ok $get->code, '==', 900, "a route that returns undef causes WD to ignore it and resume dispatching"; } + +sub matcher_nonsub_pair { + @dispatch = ( match_true() => 5 ); + + my $get = run_request( GET => 'http://localhost/' ); + + cmp_ok $get->code, '==', 500, "a route definition that pairs a WD::Matcher a non-sub dies"; + like $get->content, qr[No idea how we got here with Web::Dispatch::M], + "the error message points out the broken definition"; +}