X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=t%2F55-yaml.t;h=0f80d26ababcba1a80e1a802f68135c0d131110a;hp=3c95831e6e28243d9687002642d136fc6064ccb3;hb=712235202a9cc46d4d5efa86a7f40c64771f9498;hpb=5a2e0210fe5c7da046be37b4240008f2b667be67 diff --git a/t/55-yaml.t b/t/55-yaml.t index 3c95831..0f80d26 100644 --- a/t/55-yaml.t +++ b/t/55-yaml.t @@ -1,14 +1,16 @@ use strict; use warnings; +no warnings 'once'; use Test::More; +use Config::Any; use Config::Any::YAML; -if ( !Config::Any::YAML->is_supported ) { +if ( !Config::Any::YAML->is_supported && !$ENV{RELEASE_TESTING} ) { plan skip_all => 'YAML format not supported'; } else { - plan tests => 2; + plan tests => 6; } { @@ -16,3 +18,21 @@ else { ok( $config ); is( $config->{ name }, 'TestApp' ); } + +# test invalid config +{ + my $file = 't/invalid/conf.yml'; + my $config = eval { Config::Any::YAML->load( $file ) }; + + is $config, undef, 'config load failed'; + isnt $@, '', 'error thrown'; +} + +# parse error generated on invalid config +{ + my $file = 't/invalid/conf.yml'; + my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) }; + + is $config, undef, 'config load failed'; + isnt $@, '', 'error thrown'; +}