added a flatten_to_hash option to return a simple key-value hashref instead of the...
[p5sagit/Config-Any.git] / t / 62-multi.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 3;
5
6 use Config::Any;
7 use Config::Any::YAML;
8
9 my $file   = 't/multi/conf.yml';
10 my @expect = (
11     {   name  => 'TestApp',
12         Model => { 'Model::Baz' => { qux => 'xyzzy' } }
13     },
14     {   name2  => 'TestApp2',
15         Model2 => { 'Model::Baz2' => { qux2 => 'xyzzy2' } }
16     },
17 );
18
19 my @results = eval { Config::Any::YAML->load( $file ); };
20
21 SKIP: {
22     skip "Can't load multi-stream YAML files", 3 if $@;
23     is( @results, 2, '2 documents' );
24     is_deeply( \@results, \@expect, 'structures ok' );
25
26     my $return
27         = Config::Any->load_files( { use_ext => 1, files => [ $file ] } );
28     is_deeply(
29         $return,
30         [ { $file => \@expect } ],
31         'config-any structures ok'
32     );
33 }