[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master d4e4860 3/7: Define a default error prefix
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master d4e4860 3/7: Define a default error prefix |
Date: |
Thu, 9 Feb 2017 19:49:25 -0500 (EST) |
branch: master
commit d4e4860a53bb47124241744de0ece4c091513c2e
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Define a default error prefix
This provides a more robust way to reset error_prefix to its default.
---
exit_codes.hpp | 3 ++-
test_main.cpp | 4 +++-
test_tools_test.cpp | 2 +-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/exit_codes.hpp b/exit_codes.hpp
index 709bb83..b51794c 100644
--- a/exit_codes.hpp
+++ b/exit_codes.hpp
@@ -88,7 +88,8 @@ namespace lmi_test
// (because this is the one header included by all unit-test files) to
// write such declarations here.
- extern std::string error_prefix;
+ extern std::string const default_error_prefix;
+ extern std::string error_prefix;
} // namespace lmi_test
#endif // exit_codes_hpp
diff --git a/test_main.cpp b/test_main.cpp
index a796a3b..9b3aed1 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -85,11 +85,13 @@ namespace lmi_test
};
} // namespace test
+ 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.
// 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::string error_prefix = default_error_prefix;
std::ostream& error_stream()
{
diff --git a/test_tools_test.cpp b/test_tools_test.cpp
index 33823cf..a86f2bc 100644
--- a/test_tools_test.cpp
+++ b/test_tools_test.cpp
@@ -104,7 +104,7 @@ int test_main(int, char*[])
// The following tests, unlike those above, should not fail.
- lmi_test::error_prefix = "\n**** ";
+ lmi_test::error_prefix = lmi_test::default_error_prefix;
// Ensure that the anticipated and actually-thrown exceptions are
// treated as equivalent even though the latter has an extra
- [lmi-commits] [lmi] master updated (39d1ed2 -> a306d67), Greg Chicares, 2017/02/09
- [lmi-commits] [lmi] master b15bc70 2/7: Declare error_prefix where all unit-test code can see it, Greg Chicares, 2017/02/09
- [lmi-commits] [lmi] master 169b029 1/7: Move error_prefix to a different namespace, Greg Chicares, 2017/02/09
- [lmi-commits] [lmi] master d4e4860 3/7: Define a default error prefix,
Greg Chicares <=
- [lmi-commits] [lmi] master cd8ae33 5/7: Robustify, Greg Chicares, 2017/02/09
- [lmi-commits] [lmi] master 1f9ca3c 6/7: Add success_prefix to complement error_prefix, Greg Chicares, 2017/02/09
- [lmi-commits] [lmi] master a306d67 7/7: Use a more distinctive marker for test failures, Greg Chicares, 2017/02/09
- [lmi-commits] [lmi] master 2fc9371 4/7: Use (default_)error_prefix in other appropriate cases, Greg Chicares, 2017/02/09