summaryrefslogtreecommitdiffstats
path: root/t/codespell.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:40:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 09:40:31 +0000
commitb86570f63e533abcbcb97c2572e0e5732a96307b (patch)
treecabc83be691530ae685c45a8bc7620ccc0e1ebdf /t/codespell.t
parentInitial commit. (diff)
downloaddpkg-b86570f63e533abcbcb97c2572e0e5732a96307b.tar.xz
dpkg-b86570f63e533abcbcb97c2572e0e5732a96307b.zip
Adding upstream version 1.20.13.upstream/1.20.13upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/codespell.t')
-rw-r--r--t/codespell.t75
1 files changed, 75 insertions, 0 deletions
diff --git a/t/codespell.t b/t/codespell.t
new file mode 100644
index 0000000..13d66ee
--- /dev/null
+++ b/t/codespell.t
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Dpkg qw(:needs);
+
+test_needs_author();
+test_needs_command('codespell');
+test_needs_srcdir_switch();
+
+plan tests => 1;
+
+my @codespell_skip = qw(
+ .git
+ *.po
+ *.pot
+ *.gmo
+ *.add
+ *.cache
+ *~
+ .libs
+ .deps
+ ChangeLog
+ Makefile.in
+ Makefile
+ configure
+ config.*
+ libtool
+ libtool.m4
+ aclocal.m4
+ autom4te.cache
+ _build
+ build-aux
+ build-tree
+ tmp
+);
+my $codespell_skip = join ',', @codespell_skip;
+
+my @codespell_opts = (qw(
+ --ignore-words=t/codespell/stopwords
+), (
+ "--skip=$codespell_skip"
+));
+my $tags = qx(codespell @codespell_opts 2>&1);
+
+# Fixup the output:
+$tags =~ s/^WARNING: Binary file:.*\n//mg;
+$tags =~ s{^\./build-aux/.*\n}{}mg;
+$tags =~ s{^\./man/[a-zA-Z_]+/.*\n}{}mg;
+# XXX: Ignore python-3.8 runtime warnings:
+$tags =~ s{^.*: RuntimeWarning: line buffering .*\n}{}mg;
+$tags =~ s{^\s*file = builtins.open.*\n}{}mg;
+chomp $tags;
+
+my $ok = length $tags == 0;
+
+ok($ok, 'codespell');
+if (not $ok) {
+ diag($tags);
+}