X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=t%2F54-xml.t;h=02fd79376b35d109c6001baf20e4a4329126903d;hp=c8f94e963be6dd401f416f6171a3b8a6b8ffaae1;hb=11501cf7c7fd46e8723c2de165a00e2f8deefc72;hpb=572501abb2165014af8973bf9a4aa1f8a522356d diff --git a/t/54-xml.t b/t/54-xml.t index c8f94e9..02fd793 100644 --- a/t/54-xml.t +++ b/t/54-xml.t @@ -1,11 +1,27 @@ -use Test::More tests => 2; - -use Config::Any::XML; - -my $config = eval { Config::Any::XML->load( 't/conf/conf.xml' ) }; - -SKIP: { - skip "Couldn't Load XML plugin", 2 if $@; - ok( $config ); - is( $config->{ name }, 'TestApp' ); -} +use strict; +use warnings; + +use Test::More; +use Config::Any::XML; + +if ( !Config::Any::XML->is_supported ) { + plan skip_all => 'XML format not supported'; +} +else { + plan tests => 4; +} + +{ + my $config = Config::Any::XML->load( 't/conf/conf.xml' ); + ok( $config ); + is( $config->{ name }, 'TestApp' ); +} + +# test invalid config +{ + my $file = 't/invalid/conf.xml'; + my $config = eval { Config::Any::XML->load( $file ) }; + + ok( !$config, 'config load failed' ); + ok( $@, "error thrown ($@)" ); +}