lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master fec9d6d: Establish the One True nonempty d-ch


From: Greg Chicares
Subject: [lmi-commits] [lmi] master fec9d6d: Establish the One True nonempty d-char-sequence
Date: Tue, 9 Mar 2021 08:20:25 -0500 (EST)

branch: master
commit fec9d6d9b3375750fec9e5413514131ebc82326c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Establish the One True nonempty d-char-sequence
---
 md5sum_cli.cpp        | 12 ++++++------
 rate_table_test.cpp   | 41 ++++++++++++++++++++++-------------------
 test_coding_rules.cpp | 27 +++++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/md5sum_cli.cpp b/md5sum_cli.cpp
index 202befd..fa61d7a 100644
--- a/md5sum_cli.cpp
+++ b/md5sum_cli.cpp
@@ -40,7 +40,8 @@ int usage(int status)
         {
         std::cout
             <<
-R"(Usage: lmi_md5sum [OPTION]... [FILE]...
+1 + R"--cut-here--(
+Usage: lmi_md5sum [OPTION]... [FILE]...
 Print or check MD5 (128-bit) checksums.
 
   -b, --binary   read in binary mode (default)
@@ -61,8 +62,7 @@ line with checksum, a space, a character indicating input 
mode ('*' for binary
 
 This program is a limited functionality variant of GNU 'md5sum' utility
 and is part of the 'Let Me Illustrate' project.
-)"
-        ;
+)--cut-here--";
         }
     return status;
 }
@@ -71,12 +71,12 @@ void version()
 {
     std::cout
         <<
-R"(lmi_md5sum 0.9
+1 + R"--cut-here--(
+lmi_md5sum 0.9
 
 This program is a limited functionality variant of GNU 'md5sum' utility
 and is part of the 'Let Me Illustrate' project.
-)"
-        ;
+)--cut-here--";
 }
 
 // For long options that have no equivalent short option, use a
diff --git a/rate_table_test.cpp b/rate_table_test.cpp
index e4f2bee..9b325d6 100644
--- a/rate_table_test.cpp
+++ b/rate_table_test.cpp
@@ -131,18 +131,20 @@ std::string const qx_ins_path("/opt/lmi/data/qx_ins");
 
 /// Prefix used for the test tables.
 std::string const simple_table_header =
-    "Table number: 1\n"
-    "Table type: Aggregate\n"
-    "Minimum age: 0\n"
-    "Maximum age: 1\n"
-    "Number of decimal places: 5\n"
-    "Table values:\n"
-    ;
+1 + R"--cut-here--(
+Table number: 1
+Table type: Aggregate
+Minimum age: 0
+Maximum age: 1
+Number of decimal places: 5
+Table values:
+)--cut-here--";
 
 std::string const simple_table_values =
-    "  0  0.12345\n"
-    "  1  0.23456\n"
-    ;
+1 + R"--cut-here--(
+  0  0.12345
+  1  0.23456
+)--cut-here--";
 
 /// Minimal valid SOA table in text format.
 std::string const simple_table_text(simple_table_header + simple_table_values);
@@ -152,15 +154,16 @@ std::string const simple_table_text(simple_table_header + 
simple_table_values);
 /// four: two spaces between columns, plus one for the data, plus one
 /// for a nonexistent decimal point.
 std::string const integral_table =
-    "Table number: 1\n"
-    "Table type: Aggregate\n"
-    "Minimum age: 0\n"
-    "Maximum age: 1\n"
-    "Number of decimal places: 0\n"
-    "Table values:\n"
-    "  0   0\n"
-    "  1   1\n"
-    ;
+1 + R"--cut-here--(
+Table number: 1
+Table type: Aggregate
+Minimum age: 0
+Maximum age: 1
+Number of decimal places: 0
+Table values:
+  0   0
+  1   1
+)--cut-here--";
 } // Unnamed namespace.
 
 /// Test opening database files.
diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp
index 9ce6f76..7bf150b 100644
--- a/test_coding_rules.cpp
+++ b/test_coding_rules.cpp
@@ -625,6 +625,32 @@ void check_cxx(file const& f)
         }
 
     {
+    // See:
+    //   https://lists.nongnu.org/archive/html/lmi/2021-03/msg00032.html
+    static boost::regex const r(R"(\<R"([^(]*)[(])");
+    boost::sregex_iterator i(f.data().begin(), f.data().end(), r);
+    boost::sregex_iterator const omega;
+    for(; i != omega; ++i)
+        {
+        boost::smatch const& z(*i);
+        if
+            (   "test_coding_rules.cpp" != f.leaf_name()
+            &&  "--cut-here--" != z[1]
+            &&  ""             != z[1]
+            )
+            {
+            std::ostringstream oss;
+            oss
+                << "contains noncanonical d-char-seq: '"
+                << z[1]
+                << "'. Instead, use '--cut-here--'."
+                ;
+            complain(f, oss.str());
+            }
+        }
+    }
+
+    {
     static std::string const p(R"(\bfor\b[^\n]+[^:\n]:[^:\n][^)\n]+\))");
     static std::string const q(R"(\bfor\b\( *([:\w]+)( *[^ ]*) *\w+([ :]+))");
     // This is "p && q || p", so to speak. If 'p' doesn't match, then
@@ -818,6 +844,7 @@ void check_label_indentation(file const& f)
         boost::smatch const& z(*i);
         if
             (   "default" != z[2]
+            &&  "Usage"   != z[2]
             &&  "  "      != z[1]
             &&  "      "  != z[1]
             )



reply via email to

[Prev in Thread] Current Thread [Next in Thread]