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=45fd66e805ff48a600267cdb46b95245bd5cac48;hp=fb52d511e6cc64c981be2028bed087c8fc099a88;hb=766100bdb8cc2f48b73464a9364a1dab276d186e;hpb=5a2e0210fe5c7da046be37b4240008f2b667be67 diff --git a/t/54-xml.t b/t/54-xml.t index fb52d51..45fd66e 100644 --- a/t/54-xml.t +++ b/t/54-xml.t @@ -8,7 +8,7 @@ if ( !Config::Any::XML->is_supported ) { plan skip_all => 'XML format not supported'; } else { - plan tests => 2; + plan tests => 6; } { @@ -16,3 +16,26 @@ else { ok( $config ); is( $config->{ name }, 'TestApp' ); } + +# test invalid config +SKIP: { + my $broken_libxml + = eval { require XML::LibXML; XML::LibXML->VERSION lt '1.59'; }; + skip 'XML::LibXML < 1.58 has issues', 2 if $broken_libxml; + + local $SIG{ __WARN__ } = sub { }; # squash warnings from XML::Simple + my $file = 't/invalid/conf.xml'; + my $config = eval { Config::Any::XML->load( $file ) }; + + ok( !$config, 'config load failed' ); + ok( $@, "error thrown ($@)" ); +} + +# test conf file with array ref +{ + my $file = 't/conf/conf_arrayref.xml'; + my $config = eval { Config::Any::XML->load( $file ) }; + + ok( $config, 'config loaded' ); + ok( !$@, 'no error thrown' ); +}