104 lines
2.6 KiB
Perl
104 lines
2.6 KiB
Perl
|
#!/usr/bin/perl
|
||
|
|
||
|
# Copyright (C) 2015-2017 Johannes Schauer <josch@mister-muffin.de>
|
||
|
#
|
||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
# of this software and associated documentation files (the "Software"), to
|
||
|
# deal in the Software without restriction, including without limitation the
|
||
|
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||
|
# sell copies of the Software, and to permit persons to whom the Software is
|
||
|
# furnished to do so, subject to the following conditions:
|
||
|
#
|
||
|
# The above copyright notice and this permission notice shall be included in
|
||
|
# all copies or substantial portions of the Software.
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
|
||
|
use Test::More tests => 6;
|
||
|
|
||
|
require "./multistrap";
|
||
|
|
||
|
my %tests = (
|
||
|
complex => {
|
||
|
general => {
|
||
|
include => [
|
||
|
[ 'branch1.ini', 'branch2.ini' ],
|
||
|
[
|
||
|
[ ['shared.ini'], [], ['t/data/branch1.ini'] ],
|
||
|
[
|
||
|
['intermediate.ini'],
|
||
|
[ [ ['shared.ini'], [], ['t/data/intermediate.ini'] ] ],
|
||
|
['t/data/branch2.ini']
|
||
|
]
|
||
|
],
|
||
|
['t/data/complex.ini']
|
||
|
],
|
||
|
property => [
|
||
|
['1'],
|
||
|
[
|
||
|
[
|
||
|
['2'], [ [ ['4'], [], ['t/data/shared.ini'] ] ],
|
||
|
['t/data/branch1.ini']
|
||
|
],
|
||
|
[
|
||
|
['3'], [ [ ['4'], [], ['t/data/shared.ini'] ] ],
|
||
|
['t/data/branch2.ini']
|
||
|
],
|
||
|
],
|
||
|
['t/data/complex.ini']
|
||
|
],
|
||
|
foo => [ ['bar'], [], ['t/data/intermediate.ini'] ]
|
||
|
}
|
||
|
},
|
||
|
shared => {
|
||
|
general => { property => [ ['4'], [], ['t/data/shared.ini'] ] }
|
||
|
},
|
||
|
intermediate => {
|
||
|
general => {
|
||
|
include => [ ['shared.ini'], [], ['t/data/intermediate.ini'] ],
|
||
|
property => [ ['4'], [], ['t/data/shared.ini'] ],
|
||
|
foo => [ ['bar'], [], ['t/data/intermediate.ini'] ]
|
||
|
}
|
||
|
},
|
||
|
branch1 => {
|
||
|
general => {
|
||
|
include => [ ['shared.ini'], [], ['t/data/branch1.ini'] ],
|
||
|
property => [
|
||
|
['2'], [ [ ['4'], [], ['t/data/shared.ini'] ] ],
|
||
|
['t/data/branch1.ini']
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
branch2 => {
|
||
|
general => {
|
||
|
include => [
|
||
|
['intermediate.ini'],
|
||
|
[ [ ['shared.ini'], [], ['t/data/intermediate.ini'] ] ],
|
||
|
['t/data/branch2.ini']
|
||
|
],
|
||
|
property => [
|
||
|
['3'], [ [ ['4'], [], ['t/data/shared.ini'] ] ],
|
||
|
['t/data/branch2.ini']
|
||
|
],
|
||
|
foo => [ ['bar'], [], ['t/data/intermediate.ini'] ]
|
||
|
}
|
||
|
},
|
||
|
concat => {
|
||
|
general => {
|
||
|
property => [
|
||
|
[ '4', '1' ], [], [ 't/data/shared.ini', 't/data/simple.ini' ]
|
||
|
],
|
||
|
include =>
|
||
|
[ [ 'shared.ini', 'simple.ini' ], [], ['t/data/concat.ini'] ]
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
|
||
|
use Data::Dumper;
|
||
|
print(Data::Dumper->Dump([multistrap::cascade("t/data/concat.ini")]));
|
||
|
|
||
|
foreach my $k ( sort keys %tests ) {
|
||
|
is_deeply( multistrap::cascade("t/data/$k.ini"), $tests{$k}, "$k.ini" );
|
||
|
}
|