lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 1f9ca3c 6/7: Add success_prefix to complement


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 1f9ca3c 6/7: Add success_prefix to complement error_prefix
Date: Thu, 9 Feb 2017 19:49:26 -0500 (EST)

branch: master
commit 1f9ca3c6402bb4eb53b5f42089d5c32ccb148bcd
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Add success_prefix to complement error_prefix
---
 catch_exceptions.hpp |  1 +
 exit_codes.hpp       |  1 +
 test_main.cpp        | 15 ++++++++++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/catch_exceptions.hpp b/catch_exceptions.hpp
index 9e29a42..1207c41 100644
--- a/catch_exceptions.hpp
+++ b/catch_exceptions.hpp
@@ -174,6 +174,7 @@ namespace lmi_test
             {
             out
                 << std::flush
+                << success_prefix
                 << "no errors detected"
                 << std::endl
                 ;
diff --git a/exit_codes.hpp b/exit_codes.hpp
index b51794c..3220166 100644
--- a/exit_codes.hpp
+++ b/exit_codes.hpp
@@ -88,6 +88,7 @@ namespace lmi_test
     // (because this is the one header included by all unit-test files) to
     // write such declarations here.
 
+    extern std::string             success_prefix;
     extern std::string const default_error_prefix;
     extern std::string               error_prefix;
 } // namespace lmi_test
diff --git a/test_main.cpp b/test_main.cpp
index 9b3aed1..351ed12 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -85,7 +85,20 @@ namespace lmi_test
     };
   } // namespace test
 
-    std::string const default_error_prefix = "\n**** ";
+    // Rationale for writing these prefixen as concatenations of short
+    // string literals: during pre-release testing, an error in the
+    // following statement created an appearance that every test had
+    // succeeded when actually none could be built, because gcc emitted
+    // the (not-then-obfuscated) success prefix once for each test as
+    // part of an error message...and therefore 'grep --count' found
+    // exactly the expected number of apparent success markers.
+
+    std::string success_prefix             = "\n!""!""!""! ";
+
+    // There is no 'default_success_prefix' because there is no need to
+    // override 'success_prefix'.
+
+    std::string const default_error_prefix = "\n*""*""*""* ";
 
     // Change this to test this testing library's facilities without
     // emitting this actual prefix, e.g., to force simulated errors.



reply via email to

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