typo fix (RT #87779)
[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 {
7adf5673 11 plan tests => 7;
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
7adf5673 27{
766100bd 28 my $config
29 = Config::Any::General->load( 't/conf/single_element_arrayref.conf' );
30 is_deeply $config->{ foo }, [ 'bar' ], 'single element arrayref';
7adf5673 31}
32
5770ffc0 33# test invalid config
34{
77f14cda 35 my $file = 't/invalid/conf.conf';
5770ffc0 36 my $config = eval { Config::Any::General->load( $file ) };
37
38 ok( !$config, 'config load failed' );
dcfb1d1d 39 ok( $@, "error thrown ($@)" );
5770ffc0 40}