File: 52-json.t

package info (click to toggle)
libconfig-any-perl 0.23-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 340 kB
  • sloc: perl: 1,578; xml: 28; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 528 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use strict;
use warnings;

use Test::More;
use Config::Any::JSON;

if ( !Config::Any::JSON->is_supported ) {
    plan skip_all => 'JSON format not supported';
}
else {
    plan tests => 4;
}

{
    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 ($@)" );
}