X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=t%2F55-yaml.t;h=907d576bdd1229bba5ff03851fd0f649d961a775;hp=caf6f66650311653ac08d2196ada7bfbbc30ab3e;hb=3a4895023ae6455d2fdef716214e94c3e3ddfdcc;hpb=e7be073ac39914776ae469d6d1b51b666f6210d5 diff --git a/t/55-yaml.t b/t/55-yaml.t index caf6f66..907d576 100644 --- a/t/55-yaml.t +++ b/t/55-yaml.t @@ -3,15 +3,24 @@ use warnings; no warnings 'once'; use Test::More; +use Config::Any; use Config::Any::YAML; +use Data::Dumper; -$Config::Any::YAML::NO_YAML_XS_WARNING = 1; +sub _dump { + local $Data::Dumper::Terse = 1; + local $Data::Dumper::Sortkeys = 1; + local $Data::Dumper::Indent = 1; + my $out = Data::Dumper::Dumper(@_); + $out =~ s/\s*\z//; + $out eq 'undef' ? undef : $out; +} -if ( !Config::Any::YAML->is_supported ) { +if ( !Config::Any::YAML->is_supported && !$ENV{RELEASE_TESTING} ) { plan skip_all => 'YAML format not supported'; } else { - plan tests => 4; + plan tests => 6; } { @@ -25,6 +34,16 @@ else { my $file = 't/invalid/conf.yml'; my $config = eval { Config::Any::YAML->load( $file ) }; - ok( !$config, 'config load failed' ); - ok( $@, "error thrown ($@)" ); + + is _dump($config), undef, 'config load failed'; + isnt $@, '', 'error thrown'; +} + +# parse error generated on invalid config +{ + my $file = 't/invalid/conf.yml'; + my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) }; + + is _dump($config), undef, 'config load failed'; + isnt $@, '', 'error thrown'; }