lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 169b029 1/7: Move error_prefix to a different


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 169b029 1/7: Move error_prefix to a different namespace
Date: Thu, 9 Feb 2017 19:49:25 -0500 (EST)

branch: master
commit 169b029bebebfce3ba79afab7e6bf4e20a36f4fb
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Move error_prefix to a different namespace
    
    Introducing it into namespace lmi_test::test seems to have been a
    mistake: it doesn't complement the very few entities defined in that
    inner namespace.
---
 test_main.cpp       | 18 +++++++++---------
 test_tools.hpp      |  2 +-
 test_tools_test.cpp |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/test_main.cpp b/test_main.cpp
index 67eede0..a796a3b 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -75,12 +75,6 @@ namespace lmi_test
 {
   namespace test
   {
-    // Change this to test this testing library's facilities without
-    // emitting this actual prefix, e.g., to force simulated errors.
-    // Change it back to perform tests that are intended to pass,
-    // e.g., tests to validate internal helpers such as whats_what().
-    std::string error_prefix = "\n**** ";
-
     int test_tools_errors = 0;  // Count of errors detected.
     int test_tools_successes = 0;  // Count of successful tests.
 
@@ -91,9 +85,15 @@ namespace lmi_test
     };
   } // namespace test
 
+    // Change this to test this testing library's facilities without
+    // emitting this actual prefix, e.g., to force simulated errors.
+    // Change it back to perform tests that are intended to pass,
+    // e.g., tests to validate internal helpers such as whats_what().
+    std::string error_prefix = "\n**** ";
+
     std::ostream& error_stream()
     {
-        return std::cout << test::error_prefix << "test failed: ";
+        return std::cout << error_prefix << "test failed: ";
     }
 
     void record_error()
@@ -159,7 +159,7 @@ int cpp_main(int argc, char* argv[])
     catch(lmi_test::test::test_tools_exception const&)
         {
         std::cout
-            << lmi_test::test::error_prefix
+            << lmi_test::error_prefix
             << "previous test error is fatal"
             << std::endl
             ;
@@ -171,7 +171,7 @@ int cpp_main(int argc, char* argv[])
     if(lmi_test::test::test_tools_errors)
         {
         std::cout
-            << lmi_test::test::error_prefix
+            << lmi_test::error_prefix
             << lmi_test::test::test_tools_errors
             << " test errors detected; "
             << lmi_test::test::test_tools_successes
diff --git a/test_tools.hpp b/test_tools.hpp
index dd3fbda..1472f2f 100644
--- a/test_tools.hpp
+++ b/test_tools.hpp
@@ -198,7 +198,7 @@ bool whats_what(std::string const& observed, what_regex 
const& expected);
         {                                   \
         lmi_test::record_error();           \
         lmi_test::error_stream()            \
-            << lmi_test::test::error_prefix \
+            << lmi_test::error_prefix       \
             << "test failed: "              \
             << (exp)                        \
             << "\n[invoked from "           \
diff --git a/test_tools_test.cpp b/test_tools_test.cpp
index 6625b1f..33823cf 100644
--- a/test_tools_test.cpp
+++ b/test_tools_test.cpp
@@ -54,7 +54,7 @@ int test_main(int, char*[])
     // failures are reported with a distinctive prefix so that they
     // don't look like real errors.
 
-    lmi_test::test::error_prefix = "\n#### ";
+    lmi_test::error_prefix = "\n#### ";
 
     BOOST_TEST(always_true);
     BOOST_TEST(always_false);
@@ -104,7 +104,7 @@ int test_main(int, char*[])
 
     // The following tests, unlike those above, should not fail.
 
-    lmi_test::test::error_prefix = "\n**** ";
+    lmi_test::error_prefix = "\n**** ";
 
     // Ensure that the anticipated and actually-thrown exceptions are
     // treated as equivalent even though the latter has an extra



reply via email to

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