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 | ||
5a2e0210 | 8 | if ( !Config::Any::YAML->is_supported ) { |
9 | plan skip_all => 'YAML format not supported'; | |
10 | } | |
11 | else { | |
5770ffc0 | 12 | plan tests => 4; |
5a2e0210 | 13 | } |
f0e3c221 | 14 | |
5a2e0210 | 15 | { |
16 | my $config = Config::Any::YAML->load( 't/conf/conf.yml' ); | |
f0e3c221 | 17 | ok( $config ); |
18 | is( $config->{ name }, 'TestApp' ); | |
19 | } | |
5770ffc0 | 20 | |
21 | # test invalid config | |
22 | { | |
77f14cda | 23 | my $file = 't/invalid/conf.yml'; |
5770ffc0 | 24 | my $config = eval { Config::Any::YAML->load( $file ) }; |
25 | ||
26 | ok( !$config, 'config load failed' ); | |
dcfb1d1d | 27 | ok( $@, "error thrown ($@)" ); |
5770ffc0 | 28 | } |