use is_supported to figure out if we can test a loader
[p5sagit/Config-Any.git] / t / 20-parse.t
index 47d38e7..7396003 100644 (file)
@@ -1,6 +1,7 @@
 package MockApp;
 use strict;
 use warnings;
+no warnings 'once';
 
 $|++;
 use Test::More tests => 54;
@@ -13,6 +14,8 @@ use Config::Any::Perl;
 use Config::Any::XML;
 use Config::Any::YAML;
 
+$Config::Any::YAML::NO_YAML_XS_WARNING = 1;
+
 our %ext_map = (
     conf => 'Config::Any::General',
     ini  => 'Config::Any::INI',
@@ -28,12 +31,7 @@ sub load_parser_for {
 
     my ( $ext ) = $f =~ m{ \. ( [^\.]+ ) \z }xms;
     my $mod = $ext_map{ $ext };
-    my $mod_load_result;
-    eval {
-        $mod_load_result = $mod->load( $f );
-        delete $INC{ $f } if $ext eq 'pl';
-    };
-    return $@ ? ( 1, $mod ) : ( 0, $mod );
+    return !$mod->is_supported ? ( 1, $mod ) : ( 0, $mod );
 }
 
 for my $f ( map { "t/conf/conf.$_" } keys %ext_map ) {