ignore cycles that are taken care of in Template::Provider#DESTROY

This commit is contained in:
Graham Ollis
2012-08-21 15:44:33 -04:00
parent 2956335d9e
commit a72ec0e750

View File

@@ -43,8 +43,17 @@ $t->get_ok('/')->status_is(200)
->content_like(qr/test123456/);
$t->get_ok('/blow')->status_is(500)->content_like(qr/file error - doesnotexist.tt: No such file or directory/);
if(eval q{ use Test::Memory::Cycle; 1 })
if(eval q{ use Devel::Cycle; 1 })
{
Test::Memory::Cycle::memory_cycle_ok(app);
}
Devel::Cycle::find_cycle(app, sub {
my $arg = shift;
# Template::Provider (from which M::P::T::Provider inherits) has some cycles which are freed manaully by
# its DESTROY method, so we skip reporting those cycles.
unless(scalar(scalar(grep { ref($_->[2]) eq 'Mojolicious::Plugin::TtRenderer::Provider' && $_->[1] =~ /^(HEAD|TAIL|LOOKUP)$/ } @$arg)) > 0)
{
#use YAML ();
#diag YAML::Dump([ map { [ $_->[0], $_->[1], ref($_->[2]), ref($_->[3]) ] } @$arg ]);
fail('Cycle found')
}
});
};