X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F53-perl.t;h=1a749a1dd346e9b6d60bdf917cb8aeffbd30c126;hb=77afca3b1e24dee5bc1cecbc30fd3be9ea448889;hp=427f611c58bd1decd61cc4661001ca6e61cfe802;hpb=572501abb2165014af8973bf9a4aa1f8a522356d;p=p5sagit%2FConfig-Any.git diff --git a/t/53-perl.t b/t/53-perl.t index 427f611..1a749a1 100644 --- a/t/53-perl.t +++ b/t/53-perl.t @@ -1,11 +1,35 @@ -use Test::More tests => 2; - -use Config::Any::Perl; - -my $config = eval { Config::Any::Perl->load( 't/conf/conf.pl' ) }; - -SKIP: { - skip "Couldn't Load Perl plugin", 2 if $@; - ok( $config ); - is( $config->{ name }, 'TestApp' ); -} +use strict; +use warnings; + +use Test::More tests => 7; +use Config::Any; +use Config::Any::Perl; + +{ + my $file = 't/conf/conf.pl'; + my $config = Config::Any::Perl->load( $file ); + + ok( $config ); + is( $config->{ name }, 'TestApp' ); + + my $config_load2 = Config::Any::Perl->load( $file ); + is_deeply( $config_load2, $config, 'multiple loads of the same file' ); +} + +# test invalid config +{ + my $file = 't/invalid/conf.pl'; + my $config = eval { Config::Any::Perl->load( $file ) }; + + ok( !$config, 'config load failed' ); + ok( $@, "error thrown ($@)" ); +} + +# parse error generated on invalid config +{ + my $file = 't/invalid/conf.pl'; + my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) }; + + ok( !$config, 'config load failed' ); + ok( $@, "error thrown ($@)" ); +}