improve diagnostics in yaml test
[p5sagit/Config-Any.git] / t / 55-yaml.t
index b6d1f9e..907d576 100644 (file)
@@ -5,8 +5,18 @@ no warnings 'once';
 use Test::More;
 use Config::Any;
 use Config::Any::YAML;
+use Data::Dumper;
 
-if ( !Config::Any::YAML->is_supported ) {
+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 && !$ENV{RELEASE_TESTING} ) {
     plan skip_all => 'YAML format not supported';
 }
 else {
@@ -24,8 +34,9 @@ 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
@@ -33,6 +44,6 @@ else {
     my $file = 't/invalid/conf.yml';
     my $config = eval { Config::Any->load_files( { files => [$file], use_ext => 1} ) };
 
-    ok( !$config, 'config load failed' );
-    ok( $@,       "error thrown ($@)" );
+    is _dump($config), undef, 'config load failed';
+    isnt $@, '', 'error thrown';
 }