File: 55-yaml.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 (30 lines) | stat: -rw-r--r-- 591 bytes parent folder | download
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
28
29
30
use strict;
use warnings;
no warnings 'once';

use Test::More;
use Config::Any::YAML;

$Config::Any::YAML::NO_YAML_XS_WARNING = 1;

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

{
    my $config = Config::Any::YAML->load( 't/conf/conf.yml' );
    ok( $config );
    is( $config->{ name }, 'TestApp' );
}

# test invalid config
{
    my $file = 't/invalid/conf.yml';
    my $config = eval { Config::Any::YAML->load( $file ) };

    ok( !$config, 'config load failed' );
    ok( $@,       "error thrown ($@)" );
}