[lintian] 02/02: t/s…/spellintian.t: Add checks for common mistakes in d…/spelling/corrections
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to branch master
in repository lintian.
commit 3cb655b2bcb896fb7ada2a46117b9750c3dff9aa
Author: Axel Beckert <abe@deuxchevaux.org>
Date: Sun Dec 3 04:06:35 2017 +0100
t/s…/spellintian.t: Add checks for common mistakes in d…/spelling/corrections
* "iff" is a valid word (c.f. #865055)
* case-only misspellings (e.g. "german||German") belong into
data/spelling/corrections-case
Since both issues showed up at least twice recently and it's tedious
to fix them over again and again, I've added these small checks to let
them be recognized via our Jenkins CI before making a new release of
Lintian.
---
debian/changelog | 4 ++++
t/scripts/spellintian.t | 33 ++++++++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 725c90e..187fa2c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,10 @@ lintian (2.5.61) UNRELEASED; urgency=medium
* t/runtests:
+ [AB] Use standards version 4.1.2 in tests.
+ * t/scripts/spellintian.t:
+ + [AB] Add two checks for common mistakes in d…/spelling/corrections:
+ "iff" is a valid word (c.f. #865055) and case-only misspellings
+ belong into data/spelling/corrections-case.
-- Chris Lamb <lamby@debian.org> Sun, 26 Nov 2017 11:51:35 +0900
diff --git a/t/scripts/spellintian.t b/t/scripts/spellintian.t
index 5cccbaf..72d47fd 100755
--- a/t/scripts/spellintian.t
+++ b/t/scripts/spellintian.t
@@ -1,6 +1,7 @@
#!/usr/bin/perl
# Copyright © 2014-2016 Jakub Wilk <jwilk@jwilk.net>
+# Copyright © 2017 Axel Beckert <abe@debian.org>
#
# This program is free software. It is distributed under the terms of
# the GNU General Public License as published by the Free Software
@@ -21,13 +22,14 @@
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 6;
use IPC::Run();
$ENV{'LINTIAN_TEST_ROOT'} //= '.';
my $cmd_path = "$ENV{LINTIAN_TEST_ROOT}/frontend/spellintian";
+my $spelling_data = 'data/spelling/corrections';
sub t {
my ($input, $expected, @options) = @_;
@@ -46,6 +48,35 @@ t($s, "familar -> familiar\nallows to -> allows one to\n");
t($s, "familar -> familiar\nallows to -> allows one to\ngnu -> GNU\n",
'--picky');
+my $iff = 0;
+my $case_sen = 0;
+
+open(my $sp_fh, '<', $spelling_data)
+ or die "Can't open $spelling_data for reading: $!";
+while (my $corr = <$sp_fh>) {
+ next if $corr =~ m{ ^\# | ^$ }x;
+ chomp($corr);
+
+ # Check if case sensitive corrections have been added to the wrong
+ # file (data/spelling/corrections, not data/spelling/corrections-case).
+ # Bad example: german||German
+ my ($wrong, $good) = split(/\|\|/, $corr);
+ $case_sen++ if ($wrong eq lc($good));
+
+ # Check if "iff" has been added as correction. See #865055 why
+ # this is wrong. Bad example: iff||if
+ $iff++ if $corr =~ m{ ^ iff \|\| }x;
+}
+close($sp_fh);
+
+ok($case_sen == 0, "No case sensitive correction present in ${spelling_data}");
+ok(
+ $iff == 0,
+ '"iff" is not present in '
+ . $spelling_data
+ .'. See #865055 why this is wrong.'
+);
+
# Local Variables:
# indent-tabs-mode: nil
# cperl-indent-level: 4
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: