r37256@bricas-laptop (orig r8347): bricas | 2008-09-03 10:53:01 -0300
[p5sagit/Config-Any.git] / t / 52-json.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Config::Any::JSON;
6
7 if ( !Config::Any::JSON->is_supported ) {
8     plan skip_all => 'JSON format not supported';
9 }
10 else {
11     plan tests => 4;
12 }
13
14 {
15     my $config = Config::Any::JSON->load( 't/conf/conf.json' );
16     ok( $config );
17     is( $config->{ name }, 'TestApp' );
18 }
19
20 # test invalid config
21 {
22     my $file = 't/invalid/conf.json';
23     my $config = eval { Config::Any::JSON->load( $file ) };
24
25     ok( !$config, 'config load failed' );
26     ok( $@,       "error thrown ($@)" );
27 }