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=65c6099a69ad6ed145a672b329003105caf814dc;hp=dcf084f13a78ea4d59453dc908ed27bbdf0bec40;hb=1d172fc510f2ed15a00d475073f6df964b398484;hpb=f0e3c2214342d0d8a8839009b8b9c7e6bfbc7ab2 diff --git a/t/52-json.t b/t/52-json.t index dcf084f..65c6099 100644 --- a/t/52-json.t +++ b/t/52-json.t @@ -1,11 +1,27 @@ -use Test::More tests => 2; +use strict; +use warnings; +use Test::More; use Config::Any::JSON; -my $config = eval { Config::Any::JSON->load( 't/conf/conf.json' ) }; +if ( !Config::Any::JSON->is_supported ) { + plan skip_all => 'JSON format not supported'; +} +else { + plan tests => 4; +} -SKIP: { - skip "Couldn't Load JSON plugin", 2 if $@; +{ + my $config = Config::Any::JSON->load( 't/conf/conf.json' ); ok( $config ); is( $config->{ name }, 'TestApp' ); } + +# test invalid config +{ + my $file = 't/invalid/conf.json'; + my $config = eval { Config::Any::JSON->load( $file ) }; + + ok( !$config, 'config load failed' ); + ok( $@, "error thrown ($@)" ); +}