diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-09-27 11:53:34 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-01-02 18:00:05 -0500 |
commit | fa37e0a68bea65979f9f8f2e5258fe608acf2bdf (patch) | |
tree | 8deac6542c23efb0dad232c4c30bc88c68187e71 /src/test/main.cpp | |
parent | 17e14ac92fced92457945859463eda5d435bdd49 (diff) |
test: Show debug log on unit test failure
Diffstat (limited to 'src/test/main.cpp')
-rw-r--r-- | src/test/main.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/main.cpp b/src/test/main.cpp index ff3f36b561..e6529949e2 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -2,6 +2,21 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +/** + * See https://www.boost.org/doc/libs/1_71_0/libs/test/doc/html/boost_test/utf_reference/link_references/link_boost_test_module_macro.html + */ #define BOOST_TEST_MODULE Bitcoin Core Test Suite #include <boost/test/unit_test.hpp> + +#include <test/util/setup_common.h> + +/** Redirect debug log to boost log */ +const std::function<void(const std::string&)> G_TEST_LOG_FUN = [](const std::string& s) { + if (s.back() == '\n') { + // boost will insert the new line + BOOST_TEST_MESSAGE(s.substr(0, s.size() - 1)); + } else { + BOOST_TEST_MESSAGE(s); + } +}; |