From: Justin Wheeler Date: Thu, 22 Oct 2009 19:57:35 +0000 (+0000) Subject: Ugly test script to verify $@ out-of-scope issue is fixed. X-Git-Tag: v0.25~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-Static-Simple.git;a=commitdiff_plain;h=fb25065eefb76d894a966dc1a3f93c299957219f Ugly test script to verify $@ out-of-scope issue is fixed. --- 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} );