refactor _load(). fix an issue with use_ext => 0. use_ext now on by default. throw...
[p5sagit/Config-Any.git] / t / 62-multi.t
diff --git a/t/62-multi.t b/t/62-multi.t
new file mode 100644 (file)
index 0000000..b8b9d7e
--- /dev/null
@@ -0,0 +1,28 @@
+use Test::More tests => 3;
+
+use strict;
+use warnings;
+
+use Config::Any;
+use Config::Any::YAML;
+
+my $file   = 't/multi/conf.yml';
+my @expect = (
+    {   name  => 'TestApp',
+        Model => { 'Model::Baz' => { qux => 'xyzzy' } }
+    },
+    {   name2  => 'TestApp2',
+        Model2 => { 'Model::Baz2' => { qux2 => 'xyzzy2' } }
+    },
+);
+
+my @results = eval { Config::Any::YAML->load( $file ); };
+
+SKIP: {
+    skip "Can't load YAML files", 3 if $@;
+    is( @results, 2, '2 documents' );
+    is_deeply( \@results, \@expect, 'structures ok' );
+
+    my $return = Config::Any->load_files( { use_ext => 1, files => [ $file ] } );
+    is_deeply( $return, [ { $file => \@expect } ], 'config-any structures ok' );
+}