added a flatten_to_hash option to return a simple key-value hashref instead of the...
[p5sagit/Config-Any.git] / t / 50-general.t
CommitLineData
5a2e0210 1use strict;
2use warnings;
f0e3c221 3
5a2e0210 4use Test::More;
f0e3c221 5use Config::Any::General;
6
5a2e0210 7if ( !Config::Any::General->is_supported ) {
8 plan skip_all => 'Config::General format not supported';
9}
10else {
5770ffc0 11 plan tests => 6;
5a2e0210 12}
f0e3c221 13
5a2e0210 14{
15 my $config = Config::Any::General->load( 't/conf/conf.conf' );
f0e3c221 16 ok( $config );
17 is( $config->{ name }, 'TestApp' );
9ac432c2 18 ok( exists $config->{ Component } );
5a2e0210 19}
9ac432c2 20
5a2e0210 21{
22 my $config = Config::Any::General->load( 't/conf/conf.conf',
23 { -LowerCaseNames => 1 } );
9ac432c2 24 ok( exists $config->{ component } );
f0e3c221 25}
5770ffc0 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}