--- /dev/null
+use Test::More tests => 9;\r
+use Test::Exception;\r
+use Config::Any;\r
+\r
+ok ( ! Config::Any->load_files(), "load_files expects args" );\r
+ok ( ! Config::Any->load_stems(), "load_stems expects args" );\r
+\r
+{\r
+ my @warnings;\r
+ local $SIG{__WARN__} = sub { push @warnings, @_ };\r
+ Config::Any->load_files({});\r
+ like (shift @warnings, qr/^no files specified/, "load_files expects files");\r
+ Config::Any->load_stems({});\r
+ like (shift @warnings, qr/^no stems specified/, "load_stems expects stems");\r
+}\r
+\r
+my @files = glob("t/conf/conf.*");\r
+my $filter = sub { return };\r
+ok(Config::Any->load_files({files=>\@files, use_ext=>0}), "use_ext 0 works");\r
+ok(Config::Any->load_files({files=>\@files, use_ext=>1}), "use_ext 1 works");\r
+\r
+ok(Config::Any->load_files({files=>\@files, use_ext=>1, filter=>\&$filter}), "filter works");\r
+eval {Config::Any->load_files({files=>\@files, use_ext=>1, filter=>sub{die}}) };\r
+ok($@, "filter breaks");\r
+\r
+my @stems = qw(t/conf/conf);\r
+ok(Config::Any->load_stems({stems=>\@stems, use_ext=>1}), "load_stems with stems works");\r
-use Test::More tests => 2;\r
+use Test::More tests => 6;\r
\r
use Config::Any::INI;\r
\r
-my $config = eval { Config::Any::INI->load( 't/conf/conf.ini' ) };\r
+my $config = eval { Config::Any::INI->load( 't/conf/conf.ini' ) };\r
+my $simpleconfig = eval { Config::Any::INI->load( 't/conf/conf2.ini' ) };\r
\r
SKIP: {\r
- skip "Couldn't Load INI plugin", 2 if $@;\r
+ skip "Couldn't Load INI plugin", 6 if $@;\r
ok( $config );\r
is( $config->{ name }, 'TestApp' );\r
+ is( $config->{Component}->{Controller::Foo}->{foo}, 'bar');\r
+ \r
+ ok( $simpleconfig );\r
+ is( $simpleconfig->{ name }, 'TestApp' );\r
+ is( $simpleconfig->{Controller::Foo}->{foo}, 'bar' );\r
}\r