X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F12check_error_scope.t;fp=t%2F12check_error_scope.t;h=9a075241887a3fd7299aeb93b04ba3306406ddb2;hb=fb25065eefb76d894a966dc1a3f93c299957219f;hp=0000000000000000000000000000000000000000;hpb=a15abf7176afb56105f74a71ae4c03a5c33fa640;p=catagits%2FCatalyst-Plugin-Static-Simple.git diff --git a/t/12check_error_scope.t b/t/12check_error_scope.t new file mode 100644 index 0000000..9a07524 --- /dev/null +++ b/t/12check_error_scope.t @@ -0,0 +1,27 @@ +#!perl + +use strict; +use warnings; +no strict 'refs'; +no warnings 'redefine'; + +use FindBin; +use lib "$FindBin::Bin/lib"; + +use Test::More tests => 3; +use Catalyst::Test 'TestApp'; + +TestApp->config->{ static }->{ dirs } = [ qr{stuff/} ]; +my $orig_sub = *Catalyst::Plugin::Static::Simple::prepare_action{CODE}; + +*Catalyst::Plugin::Static::Simple::prepare_action = sub { + my ($c) = @_; + + eval { my $var = 1 / 0 }; + + ok ($@, '$@ has a value.'); + return $orig_sub->( $c ); +}; + +ok( my $res = request("http://localhost/"), 'request ok' ); +ok( $res->code == 200, q{Previous error doesn't crash static::simple} );