[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7721853 3/5: Test for CR and VT separately
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7721853 3/5: Test for CR and VT separately |
Date: |
Wed, 7 Dec 2016 09:37:16 +0000 (UTC) |
branch: master
commit 772185300d6dd0d8ff16ae9d94f45f2e6f9f1acd
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Test for CR and VT separately
When a combined test finds either of these often-forbidden characters,
an extra manual step is necessary to determine which was found, but the
offender is virtually always only CR because VT is rarely used.
---
test_coding_rules.cpp | 12 +++++++-----
test_coding_rules_test.sh | 4 ++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/test_coding_rules.cpp b/test_coding_rules.cpp
index 53a766d..e109142 100644
--- a/test_coding_rules.cpp
+++ b/test_coding_rules.cpp
@@ -316,12 +316,14 @@ void assay_non_latin(file const& f)
void assay_whitespace(file const& f)
{
- if
- ( contains(f.data(), '\r')
- || contains(f.data(), '\v')
- )
+ if(contains(f.data(), '\r'))
+ {
+ throw std::runtime_error("File contains '\\r'.");
+ }
+
+ if(contains(f.data(), '\v'))
{
- throw std::runtime_error("File contains '\\r' or '\\v'.");
+ throw std::runtime_error("File contains '\\v'.");
}
if
diff --git a/test_coding_rules_test.sh b/test_coding_rules_test.sh
index 0c76d9e..6750b84 100755
--- a/test_coding_rules_test.sh
+++ b/test_coding_rules_test.sh
@@ -418,9 +418,9 @@ File 'eraseme_taboo_001' breaks taboo 'Shibboleth'.
File 'eraseme_taboo_001' breaks taboo 'sibboleth'.
File 'eraseme_url_001' lacks lmi URL.
Exception--file 'eraseme_whitespace_001': File contains '\f'.
-Exception--file 'eraseme_whitespace_002': File contains '\r' or '\v'.
+Exception--file 'eraseme_whitespace_002': File contains '\r'.
Exception--file 'eraseme_whitespace_003': File contains '\t'.
-Exception--file 'eraseme_whitespace_004': File contains '\r' or '\v'.
+Exception--file 'eraseme_whitespace_004': File contains '\v'.
EOF
diff --unified=0 eraseme_expected eraseme_observed && rm --force \