3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program. If not, see <https://www.gnu.org/licenses/>.
19
use Test::More tests => 3;
24
use File::Temp qw(tempfile);
26
my $srcdir = $ENV{srcdir} || '.';
27
my $datadir = "$srcdir/t/910_merge_changelogs";
31
my ($expected_file, @options) = @_;
32
my ($fh, $filename) = tempfile();
33
spawn(exec => ["$srcdir/dpkg-mergechangelogs.pl", @options],
34
to_handle => $fh, error_to_file => '/dev/null',
35
wait_child => 1, nocheck => 1);
36
my $res = compare($expected_file, $filename);
38
system("diff -u $expected_file $filename >&2");
40
ok($res == 0, "merged changelog matches expected one ($expected_file)");
44
my $has_alg_merge = 1;
45
eval 'use Algorithm::Merge;';
50
my @input = ("$datadir/ch-old", "$datadir/ch-a", "$datadir/ch-b");
52
test_merge("$datadir/ch-merged", @input);
53
test_merge("$datadir/ch-merged-pr", '-m', @input);
55
test_merge("$datadir/ch-merged-basic", @input);
56
test_merge("$datadir/ch-merged-pr-basic", '-m', @input);
58
test_merge("$datadir/ch-badver-merged", ("$datadir/ch-badver-old",
59
"$datadir/ch-badver-a", "$datadir/ch-badver-b"));