man: Add dpkg-build-api behavior for Rules-Requires-Root field defaults
[dpkg.git] / t / codespell.t
blobd09f49fab0753e10219e067ffd93aa54b683d598
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);
22 test_needs_author();
23 test_needs_command('codespell');
24 test_needs_srcdir_switch();
26 plan tests => 1;
28 my @codespell_skip = qw(
29 .git
30 *.po
31 *.pot
32 *.gmo
33 *.add
34 *.cache
35 *.policy
37 .libs
38 .deps
39 ChangeLog
40 Makefile.in
41 Makefile
42 configure
43 config.*
44 libtool
45 libtool.m4
46 aclocal.m4
47 autom4te.cache
48 _build
49 build-aux
50 build-tree
51 tmp
53 my $codespell_skip = join ',', @codespell_skip;
55 my @codespell_opts = (qw(
56 --ignore-words=t/codespell/stopwords
57 ), (
58 "--skip=$codespell_skip"
59 ));
60 my $tags = qx(codespell @codespell_opts 2>&1);
62 # Fixup the output:
63 $tags =~ s/^WARNING: Binary file:.*\n//mg;
64 $tags =~ s{^\./build-aux/.*\n}{}mg;
65 $tags =~ s{^\./man/[a-zA-Z_]+/.*\n}{}mg;
66 # XXX: Ignore python-3.8 runtime warnings:
67 $tags =~ s{^.*: RuntimeWarning: line buffering .*\n}{}mg;
68 $tags =~ s{^\s*file = builtins.open.*\n}{}mg;
69 chomp $tags;
71 my $ok = length $tags == 0;
73 ok($ok, 'codespell');
74 if (not $ok) {
75 diag($tags);