c73c68aad2cd62eb4a53e3a562b4c648fb0b9105
[p5sagit/Config-Any.git] / t / 50-general.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Config::Any::General;
6
7 if ( !Config::Any::General->is_supported ) {
8     plan skip_all => 'Config::General format not supported';
9 }
10 else {
11     plan tests => 6;
12 }
13
14 {
15     my $config = Config::Any::General->load( 't/conf/conf.conf' );
16     ok( $config );
17     is( $config->{ name }, 'TestApp' );
18     ok( exists $config->{ Component } );
19 }
20
21 {
22     my $config = Config::Any::General->load( 't/conf/conf.conf',
23         { -LowerCaseNames => 1 } );
24     ok( exists $config->{ component } );
25 }
26
27 # test invalid config
28 {
29     my $file = 't/invalid/conf.conf';
30     my $config = eval { Config::Any::General->load( $file ) };
31
32     ok( !$config, 'config load failed' );
33     ok( $@,       "error thrown ($@)" );
34 }