po: Update German man pages translation
[dpkg.git] / t / module-version.t
blob401f373cadb1f9fa0e63632d020bea04ef96c3b7
1 #!/usr/bin/perl
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/>.
16 use strict;
17 use warnings;
19 use Test::More;
20 use Test::Dpkg qw(:needs);
21 use Module::Metadata;
23 test_needs_srcdir_switch();
25 my @files = Test::Dpkg::all_perl_modules();
27 plan tests => scalar @files;
29 sub module_version_ok
31 my $file = shift;
33 my $mod = Module::Metadata->new_from_file($file, collect_pod => 1);
34 my $modver = $mod->version();
35 my $podver;
37 SKIP: {
38 if ($mod->contains_pod()) {
39 my $in_changes = 0;
41 foreach my $sect ($mod->pod_inside) {
42 if ($sect eq 'CHANGES') {
43 $in_changes = 1;
44 next;
47 if ($in_changes and $sect =~ m/^Version ([0-9x.]+)/) {
48 $podver = $1;
49 last;
53 if (not $in_changes) {
54 fail("module $file does not contain a CHANGES POD section");
55 return;
57 } else {
58 skip("module $file does not contain POD", 1);
61 if (defined $podver and $podver eq '0.xx') {
62 ok($modver =~ m/^0.\d\d$/,
63 "module $file version $modver is POD version 0.xx");
64 } else {
65 ok($modver eq $podver,
66 "module $file version $modver == POD version $podver");
71 foreach my $file (@files) {
72 module_version_ok($file);