X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fdispatch_misc.t;h=0c274134ee55fbf39330731a9eba7efdd22e69db;hb=run_if_script_args_maybe_more_useful;hp=a4ab38a7366c490e85d8b124c97849f13740746a;hpb=4bb0d044b7b948686ec4cb6598184e5136cd422a;p=catagits%2FWeb-Simple.git diff --git a/t/dispatch_misc.t b/t/dispatch_misc.t index a4ab38a..0c27413 100644 --- a/t/dispatch_misc.t +++ b/t/dispatch_misc.t @@ -17,6 +17,11 @@ my @dispatch; package MiscTest; sub dispatch_request { @dispatch } sub string_method { [ 999, [], [""] ]; } + + sub can { + die "Passed undef to can, this blows up on 5.8" unless defined($_[1]); + shift->SUPER::can(@_) + } } my $app = MiscTest->new; @@ -33,6 +38,7 @@ middleware_as_only_route(); route_returns_middleware_plus_extra(); route_returns_undef(); matcher_nonsub_pair(); +matcher_undef_method(); done_testing(); @@ -202,3 +208,13 @@ sub matcher_nonsub_pair { like $get->content, qr[No idea how we got here with Web::Dispatch::M], "the error message points out the broken definition"; } + +sub matcher_undef_method { + @dispatch = ( 'GET', undef ); + + 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 GET], + "the error message points out the broken definition"; +}