fix is_supported on General
[p5sagit/Config-Any.git] / t / 55-yaml.t
1 use strict;
2 use warnings;
3 no warnings 'once';
4
5 use Test::More;
6 use Config::Any;
7 use Config::Any::YAML;
8
9 if ( !Config::Any::YAML->is_supported && !$ENV{RELEASE_TESTING} ) {
10     plan skip_all => 'YAML format not supported';
11 }
12 else {
13     plan tests => 6;
14 }
15
16 {
17     my $config = Config::Any::YAML->load( 't/conf/conf.yml' );
18     ok( $config );
19     is( $config->{ name }, 'TestApp' );
20 }
21
22 # test invalid config
23 {
24     my $file = 't/invalid/conf.yml';
25     my $config = eval { Config::Any::YAML->load( $file ) };
26
27     is $config, undef, 'config load failed';
28     isnt $@, '', 'error thrown';
29 }
30
31 # parse error generated on invalid config
32 {
33     my $file = 't/invalid/conf.yml';
34     my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
35
36     is $config, undef, 'config load failed';
37     isnt $@, '', 'error thrown';
38 }