prereq report test
[p5sagit/Config-Any.git] / t / 55-yaml.t
CommitLineData
5a2e0210 1use strict;
2use warnings;
e7be073a 3no warnings 'once';
f0e3c221 4
5a2e0210 5use Test::More;
67a1cd50 6use Config::Any;
f0e3c221 7use Config::Any::YAML;
8
c2a19f63 9if ( !Config::Any::YAML->is_supported && !$ENV{RELEASE_TESTING} ) {
5a2e0210 10 plan skip_all => 'YAML format not supported';
11}
12else {
67a1cd50 13 plan tests => 6;
5a2e0210 14}
f0e3c221 15
5a2e0210 16{
17 my $config = Config::Any::YAML->load( 't/conf/conf.yml' );
f0e3c221 18 ok( $config );
19 is( $config->{ name }, 'TestApp' );
20}
5770ffc0 21
22# test invalid config
23{
77f14cda 24 my $file = 't/invalid/conf.yml';
5770ffc0 25 my $config = eval { Config::Any::YAML->load( $file ) };
26
e0186698 27 is $config, undef, 'config load failed';
28 isnt $@, '', 'error thrown';
5770ffc0 29}
67a1cd50 30
31# parse error generated on invalid config
32{
33 my $file = 't/invalid/conf.yml';
34 my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
35
e0186698 36 is $config, undef, 'config load failed';
37 isnt $@, '', 'error thrown';
67a1cd50 38}