aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-02 13:59:03 -0500
committerJack Lloyd <[email protected]>2018-12-02 13:59:03 -0500
commitd357b584454a5d42105cc7d4656cbf395522fd5b (patch)
tree53764073277d4c6d465b49a1db6aab0bb262ef23 /src
parent09094ea25afa3093353ce308d064036dc68ea1f0 (diff)
Better debugging output when a test fails
Printing the output key makes it easier to find the offending test.
Diffstat (limited to 'src')
-rw-r--r--src/tests/tests.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 9b6cce6e4..65808d1a5 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -1060,18 +1060,26 @@ std::vector<Test::Result> Text_Based_Test::run()
if(result.tests_failed())
{
- if(header.empty())
- result.test_note("Test #" + std::to_string(test_cnt) + " failed");
- else
- result.test_note("Test #" + std::to_string(test_cnt) + " " + header + " failed");
+ std::ostringstream oss;
+ oss << "Test # " << test_cnt << " ";
+ if(!header.empty())
+ oss << header << " ";
+ oss << " failed [Key=" << vars.get_req_str(m_output_key) << "]";
+
+ result.test_note(oss.str());
}
results.push_back(result);
}
catch(std::exception& e)
{
- results.push_back(Test::Result::Failure(header_or_name,
- "test " + std::to_string(test_cnt) +
- " failed with exception '" + e.what() + "'"));
+ std::ostringstream oss;
+ oss << "Test # " << test_cnt << " ";
+ if(!header.empty())
+ oss << header << " ";
+ oss << " failed with exception '" << e.what() << "'";
+ oss << " [Key=" << vars.get_req_str(m_output_key) << "]";
+
+ results.push_back(Test::Result::Failure(header_or_name, oss.str()));
}
if(clear_between_callbacks())