Ugly test script to verify $@ out-of-scope issue is fixed.
Justin Wheeler [Thu, 22 Oct 2009 19:57:35 +0000 (19:57 +0000)]
t/12check_error_scope.t [new file with mode: 0644]

diff --git a/t/12check_error_scope.t b/t/12check_error_scope.t
new file mode 100644 (file)
index 0000000..9a07524
--- /dev/null
@@ -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} );