X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FConfig-Any.git;a=blobdiff_plain;f=t%2F10-branches.t;h=eda0ae80c6c430d1420be0b769fe107b1789520b;hp=90dc25b8659f27fb8f6317025e6ff3af52f676db;hb=3a4895023ae6455d2fdef716214e94c3e3ddfdcc;hpb=4efab5582d1ec3acd99a2ffb898bed58d5f2420b diff --git a/t/10-branches.t b/t/10-branches.t index 90dc25b..eda0ae8 100644 --- a/t/10-branches.t +++ b/t/10-branches.t @@ -1,13 +1,19 @@ +use strict; +use warnings; +no warnings 'once'; + +# use Test::Without::Module qw(YAML YAML::Syck Config::General XML::Simple JSON JSON::Syck Config::Tiny ); use Test::More tests => 9; + use Config::Any; +use Config::Any::YAML; -ok( !Config::Any->load_stems(), "load_stems expects args" ); { my @warnings; local $SIG{ __WARN__ } = sub { push @warnings, @_ }; - Config::Any->load_files( ); + Config::Any->load_files(); like( shift @warnings, qr/^No files specified!/, @@ -21,18 +27,31 @@ ok( !Config::Any->load_stems(), "load_stems expects args" ); "load_files expects files" ); + Config::Any->load_stems(); + like( + shift @warnings, + qr/^No stems specified!/, + "load_stems expects args" + ); + Config::Any->load_stems( {} ); like( shift @warnings, - qr/^no stems specified/, + qr/^No stems specified!/, "load_stems expects stems" ); } -my @files = glob( "t/conf/conf.*" ); +my @files = glob( "t/supported/conf.*" ); +{ + require Config::Any::General; + local $SIG{ __WARN__ } = sub { } + if Config::Any::General->is_supported; + ok( Config::Any->load_files( { files => \@files, use_ext => 0 } ), + "use_ext 0 works" ); +} + my $filter = sub { return }; -ok( Config::Any->load_files( { files => \@files, use_ext => 0 } ), - "use_ext 0 works" ); ok( Config::Any->load_files( { files => \@files, use_ext => 1 } ), "use_ext 1 works" ); @@ -45,12 +64,12 @@ eval { Config::Any->load_files( { files => \@files, use_ext => 1, - filter => sub { die } + filter => sub { die "reject" } } ); }; -ok( $@, "filter breaks" ); +like $@, qr/reject/, "filter breaks"; -my @stems = qw(t/conf/conf); +my @stems = qw(t/supported/conf); ok( Config::Any->load_stems( { stems => \@stems, use_ext => 1 } ), "load_stems with stems works" );