| 1 |
use strict; |
| 2 |
use warnings; |
| 3 |
|
| 4 |
use Test::More; |
| 5 |
use Test::Exception; |
| 6 |
use English; |
| 7 |
|
| 8 |
use Dancer2::Core::App; |
| 9 |
|
| 10 |
BEGIN { |
| 11 |
# undefine ENV vars used as defaults for app environment in these tests |
| 12 |
local $ENV{DANCER_ENVIRONMENT}; |
| 13 |
local $ENV{PLACK_ENV}; |
| 14 |
} |
| 15 |
|
| 16 |
use lib q{.}; |
| 17 |
use lib './t/lib'; |
| 18 |
|
| 19 |
subtest 'bad DANCER_CONFIG_READERS' => sub { |
| 20 |
# space instead of comma, ooops |
| 21 |
$ENV{DANCER_CONFIG_READERS} |
| 22 |
= 'Dancer2::ConfigReader::File::Simple Dancer2::ConfigReader::TestDummy'; |
| 23 |
|
| 24 |
throws_ok { |
| 25 |
Dancer2::Core::App->new( name => 'basic' ); |
| 26 |
} qr{`Dancer2::ConfigReader::File::Simple Dancer2::ConfigReader::TestDummy' is not a module name}; |
| 27 |
}; |
| 28 |
|
| 29 |
subtest 'infinite loop of configs' => sub { |
| 30 |
$ENV{DANCER_CONFIG_READERS} |
| 31 |
= 'Dancer2::ConfigReader::Recursive'; |
| 32 |
|
| 33 |
throws_ok { |
| 34 |
Dancer2::Core::App->new( name => 'basic' ); |
| 35 |
} qr{MAX_CONFIGS exceeded}; |
| 36 |
|
| 37 |
}; |
| 38 |
|
| 39 |
done_testing; |