X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=t%2F52-json.t;h=c9e0967f05bbce60b23bbe30cb11a53eb9f4cac7;hp=5467ebe6c7e4d6da38434fd737eb73d27adbcb90;hb=e0186698ea45049a14a46eeffeb648a4b6092785;hpb=5a2e0210fe5c7da046be37b4240008f2b667be67 diff --git a/t/52-json.t b/t/52-json.t index 5467ebe..c9e0967 100644 --- a/t/52-json.t +++ b/t/52-json.t @@ -2,13 +2,14 @@ use strict; use warnings; use Test::More; +use Config::Any; use Config::Any::JSON; if ( !Config::Any::JSON->is_supported ) { plan skip_all => 'JSON format not supported'; } else { - plan tests => 2; + plan tests => 6; } { @@ -16,3 +17,21 @@ else { ok( $config ); is( $config->{ name }, 'TestApp' ); } + +# test invalid config +{ + my $file = 't/invalid/conf.json'; + my $config = eval { Config::Any::JSON->load( $file ) }; + + is $config, undef, 'config load failed'; + isnt $@, '', 'error thrown'; +} + +# parse error generated on invalid config +{ + my $file = 't/invalid/conf.json'; + my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) }; + + is $config, undef, 'config load failed'; + isnt $@, '', 'error thrown'; +}