X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F55-yaml.t;h=caf6f66650311653ac08d2196ada7bfbbc30ab3e;hb=a39975604eef2f215b2bf66ee5ff606aaa84fa09;hp=74ff1b1189ebb987eac929f6510fb679a6aecbca;hpb=572501abb2165014af8973bf9a4aa1f8a522356d;p=p5sagit%2FConfig-Any.git diff --git a/t/55-yaml.t b/t/55-yaml.t index 74ff1b1..caf6f66 100644 --- a/t/55-yaml.t +++ b/t/55-yaml.t @@ -1,11 +1,30 @@ -use Test::More tests => 2; - -use Config::Any::YAML; - -my $config = eval { Config::Any::YAML->load( 't/conf/conf.yml' ) }; - -SKIP: { - skip "Couldn't Load YAML plugin", 2 if $@; - ok( $config ); - is( $config->{ name }, 'TestApp' ); -} +use strict; +use warnings; +no warnings 'once'; + +use Test::More; +use Config::Any::YAML; + +$Config::Any::YAML::NO_YAML_XS_WARNING = 1; + +if ( !Config::Any::YAML->is_supported ) { + plan skip_all => 'YAML format not supported'; +} +else { + plan tests => 4; +} + +{ + my $config = Config::Any::YAML->load( 't/conf/conf.yml' ); + ok( $config ); + is( $config->{ name }, 'TestApp' ); +} + +# test invalid config +{ + my $file = 't/invalid/conf.yml'; + my $config = eval { Config::Any::YAML->load( $file ) }; + + ok( !$config, 'config load failed' ); + ok( $@, "error thrown ($@)" ); +}