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