Commit | Line | Data |
---|---|---|
5a2e0210 | 1 | use strict; |
2 | use warnings; | |
f0e3c221 | 3 | |
5a2e0210 | 4 | use Test::More; |
f0e3c221 | 5 | use Config::Any::General; |
6 | ||
5a2e0210 | 7 | if ( !Config::Any::General->is_supported ) { |
8 | plan skip_all => 'Config::General format not supported'; | |
9 | } | |
10 | else { | |
5770ffc0 | 11 | plan tests => 6; |
5a2e0210 | 12 | } |
f0e3c221 | 13 | |
5a2e0210 | 14 | { |
15 | my $config = Config::Any::General->load( 't/conf/conf.conf' ); | |
f0e3c221 | 16 | ok( $config ); |
17 | is( $config->{ name }, 'TestApp' ); | |
9ac432c2 | 18 | ok( exists $config->{ Component } ); |
5a2e0210 | 19 | } |
9ac432c2 | 20 | |
5a2e0210 | 21 | { |
22 | my $config = Config::Any::General->load( 't/conf/conf.conf', | |
23 | { -LowerCaseNames => 1 } ); | |
9ac432c2 | 24 | ok( exists $config->{ component } ); |
f0e3c221 | 25 | } |
5770ffc0 | 26 | |
27 | # test invalid config | |
28 | { | |
77f14cda | 29 | my $file = 't/invalid/conf.conf'; |
5770ffc0 | 30 | my $config = eval { Config::Any::General->load( $file ) }; |
31 | ||
32 | ok( !$config, 'config load failed' ); | |
dcfb1d1d | 33 | ok( $@, "error thrown ($@)" ); |
5770ffc0 | 34 | } |