add JSON::XS to the top of the JSON loaders list
[p5sagit/Config-Any.git] / t / 54-xml.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Config::Any::XML;
6
7 if ( !Config::Any::XML->is_supported ) {
8     plan skip_all => 'XML format not supported';
9 }
10 else {
11     plan tests => 4;
12 }
13
14 {
15     my $config = Config::Any::XML->load( 't/conf/conf.xml' );
16     ok( $config );
17     is( $config->{ name }, 'TestApp' );
18 }
19
20 # test invalid config
21 SKIP: {
22     my $broken_libxml
23         = eval { require XML::LibXML; XML::LibXML->VERSION lt '1.59'; };
24     skip 'XML::LibXML < 1.58 has issues', 2 if $broken_libxml;
25
26     local $SIG{ __WARN__ } = sub { };    # squash warnings from XML::Simple
27     my $file = 't/invalid/conf.xml';
28     my $config = eval { Config::Any::XML->load( $file ) };
29
30     ok( !$config, 'config load failed' );
31     ok( $@,       "error thrown ($@)" );
32 }