diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-09-24 10:05:21 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-09-24 10:05:21 -0500 |
commit | 8c41d36a083da4ffb4ec406e56c888d0105abc08 (patch) | |
tree | 0c43572414addbdef286799b297f4648c60d407d /tests | |
parent | Merge pull request #5848 (diff) | |
parent | Properly format multiline logs (diff) | |
download | monero-8c41d36a083da4ffb4ec406e56c888d0105abc08.tar.xz |
Merge pull request #5864
32f725d Properly format multiline logs (moneromooo-monero)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit_tests/logging.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unit_tests/logging.cpp b/tests/unit_tests/logging.cpp index 056eae604..c8526abae 100644 --- a/tests/unit_tests/logging.cpp +++ b/tests/unit_tests/logging.cpp @@ -178,3 +178,20 @@ TEST(logging, last_precedence) cleanup(); } +TEST(logging, multiline) +{ + init(); + mlog_set_categories("global:INFO"); + MGINFO("first\nsecond\nthird"); + std::string str; + ASSERT_TRUE(load_log_to_string(log_filename, str)); + ASSERT_TRUE(nlines(str) == 3); + ASSERT_TRUE(str.find("global") != std::string::npos); + ASSERT_TRUE(str.find("first") != std::string::npos); + ASSERT_TRUE(str.find("second") != std::string::npos); + ASSERT_TRUE(str.find("third") != std::string::npos); + ASSERT_TRUE(str.find("first\nsecond") == std::string::npos); + ASSERT_TRUE(str.find("second\nthird") == std::string::npos); + cleanup(); +} + |