]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test1275: verify upercase after period in markdown
authorDaniel Stenberg <daniel@haxx.se>
Tue, 11 Oct 2022 07:34:38 +0000 (09:34 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 12 Oct 2022 12:19:50 +0000 (14:19 +0200)
Script based on the #9474 pull-request logic, but implemented in perl.

Updated docs/URL-SYNTAX.md accordingly.

Suggested-by: Dan Fandrich
Closes #9697

docs/URL-SYNTAX.md
tests/data/Makefile.inc
tests/data/test1275 [new file with mode: 0644]
tests/markdown-uppercase.pl [new file with mode: 0644]

index d6470ab9911d71ac97b6c81fe29445774a18844c..691fcceacd66cf0a8bce45a1fa1af5fe83207952 100644 (file)
@@ -299,8 +299,7 @@ want the matching `MAILINDEX` numbers returned then you could search via URL:
 
     imap://user:password@mail.example.com/INBOX?TEXT%20%22foo%20bar%22
 
-.. but if you wanted matching `UID` numbers you would have to use a custom
-request:
+If you want matching `UID` numbers you have to use a custom request:
 
     imap://user:password@mail.example.com/INBOX -X "UID SEARCH TEXT \"foo bar\""
 
index 7fe87f43596f1499cbe295fef6fe115a89fb4503..c313a9b3002d984e52febb07ff1337415641a240 100644 (file)
@@ -161,7 +161,7 @@ test1240 test1241 test1242 test1243 test1244 test1245 test1246 test1247 \
 test1248 test1249 test1250 test1251 test1252 test1253 test1254 test1255 \
 test1256 test1257 test1258 test1259 test1260 test1261 test1262 test1263 \
 test1264 test1265 test1266 test1267 test1268 test1269 test1270 test1271 \
-test1272 test1273 test1274 \
+test1272 test1273 test1274 test1275 \
 \
 test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 \
 test1288 test1289 test1290 test1291 test1292 test1293 test1294 test1295 \
diff --git a/tests/data/test1275 b/tests/data/test1275
new file mode 100644 (file)
index 0000000..bd8415e
--- /dev/null
@@ -0,0 +1,30 @@
+<testcase>
+<info>
+<keywords>
+documentation
+</keywords>
+</info>
+
+#
+# Client-side
+<client>
+<server>
+none
+</server>
+
+<name>
+Verify capital letters after period in markdown files
+</name>
+
+<command type="perl">
+%SRCDIR/markdown-uppercase.pl %SRCDIR/..
+</command>
+</client>
+
+<verify>
+<stderr>
+ok
+</stderr>
+</verify>
+
+</testcase>
diff --git a/tests/markdown-uppercase.pl b/tests/markdown-uppercase.pl
new file mode 100644 (file)
index 0000000..db6a2f8
--- /dev/null
@@ -0,0 +1,91 @@
+#!/usr/bin/env perl
+#***************************************************************************
+#                                  _   _ ____  _
+#  Project                     ___| | | |  _ \| |
+#                             / __| | | | |_) | |
+#                            | (__| |_| |  _ <| |___
+#                             \___|\___/|_| \_\_____|
+#
+# Copyright (C) 2016 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# SPDX-License-Identifier: curl
+#
+###########################################################################
+
+my $root=$ARGV[0] || "..";
+
+my @m = `git ls-files -- $root`;
+
+my $errors;
+
+my %accepted=('curl' => 1,
+              'libcurl' => 1);
+
+sub checkfile {
+    my ($f) = @_;
+    chomp $f;
+    if($f !~ /\.md\z/) {
+        return;
+    }
+    open(F, "<$f");
+    my $l = 1;
+    my $prevl;
+    while(<F>) {
+        my $line = $_;
+        chomp $line;
+        if(($prevl =~ /\.\z/) && ($line =~ /^( *)([a-z]+)/)) {
+            my ($prefix, $word) = ($1, $2);
+            if(!$accepted{$word}) {
+                my $c = length($prefix);
+                print STDERR "$f:$l:$c:error: lowercase $word after period\n";
+                print STDERR "$line\n";
+                print STDERR ' ' x $c;
+                print STDERR "^\n";
+                $errors++;
+            }
+        }
+        if($line =~ /^(.*)\. +([a-z]+)/) {
+            my ($prefix, $word) = ($1, $2);
+
+            if(($prefix =~ /\.\.\z/) ||
+               ($prefix =~ /[0-9]\z/) ||
+               ($prefix =~ /e.g\z/) ||
+               ($prefix =~ /i.e\z/) ||
+               ($prefix =~ /etc\z/) ||
+               $accepted{$word}) {
+            }
+            else {
+                my $c = length($prefix) + 2;
+                print STDERR "$f:$l:$c:error: lowercase $word after period\n";
+                print STDERR "$line\n";
+                print STDERR ' ' x $c;
+                print STDERR "^\n";
+                $errors++;
+            }
+        }
+        $prevl = $line;
+        $l++;
+    }
+    close(F);
+}
+
+
+for my $f (@m) {
+    checkfile($f);
+}
+
+if($errors) {
+    exit 1;
+}
+print STDERR "ok\n";