Permalink
Browse files

return sub { $panel->content(sub { $self->render }) } leaks, not sure…

… why.
  • Loading branch information...
1 parent fc7e3b4 commit b7a6f097029200cc98387305608be5b07392b1a9 @miyagawa committed Jan 12, 2011
Showing with 45 additions and 1 deletion.
  1. +1 −1 lib/Plack/Middleware/Debug/Parameters.pm
  2. +44 −0 t/parameters-leak.t
@@ -26,7 +26,7 @@ sub run {
};
$panel->title('Request Variables');
$panel->nav_title('Request Variables');
- $panel->content( sub { $self->render_hash( $parameters, $self->elements ) } );
+ $panel->content($self->render_hash( $parameters, $self->elements ));
}
}
View
@@ -0,0 +1,44 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Test::Requires qw(Test::LeakTrace);
+use Plack::Test;
+use Plack::Builder;
+use HTTP::Request::Common qw(GET);
+use Test::More;
+
+ok (
+ my $app = sub {
+ return [
+ 200, [ 'Content-Type' => 'text/html' ],
+ ['<body>Hello World</body>']
+ ];
+ },
+ 'Created an application to test',
+);
+
+ok (
+ $app = builder {
+ enable 'Debug', panels => ['Parameters'];
+ $app;
+ },
+ 'Enabled the "Parameters" panel',
+);
+
+ok (
+ my $cb = sub {
+ shift->(GET '/');
+ },
+ 'Created callback function for test_psgi',
+);
+
+no_leaks_ok (
+ sub {
+ for (1..5) {
+ test_psgi $app, $cb;
+ }
+ },
+ 'No leaks in application',
+);
+
+done_testing;

0 comments on commit b7a6f09

Please sign in to comment.