| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
use Test::More; |
| 4 |
use Test::Fatal; |
| 5 |
use Plack::Test; |
| 6 |
|
| 7 |
eval { require Test::Memory::Cycle; 1; } |
| 8 |
or plan skip_all => 'Test::Memory::Cycle not present'; |
| 9 |
|
| 10 |
{ |
| 11 |
package Dancer2::Plugin::Null; |
| 12 |
use Dancer2::Plugin; |
| 13 |
plugin_keywords 'nothing'; |
| 14 |
sub nothing {1} |
| 15 |
} |
| 16 |
|
| 17 |
{ |
| 18 |
package MyApp::Cycles; |
| 19 |
use Dancer2; |
| 20 |
use Dancer2::Plugin::Null; |
| 21 |
|
| 22 |
set auto_page => 1; |
| 23 |
set serializer => 'JSON'; |
| 24 |
|
| 25 |
get '/**' => sub { |
| 26 |
return { hello => 'world' }; |
| 27 |
}; |
| 28 |
} |
| 29 |
|
| 30 |
my $app = MyApp::Cycles->to_app; |
| 31 |
|
| 32 |
my $runner = Dancer2->runner; |
| 33 |
Test::Memory::Cycle::memory_cycle_ok( $runner, "runner has no memory cycles" ); |
| 34 |
Test::Memory::Cycle::memory_cycle_ok( $app, "App has no memory cycles" ); |
| 35 |
|
| 36 |
done_testing(); |