diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-06-22 14:42:48 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-09-16 16:58:01 +0000 |
commit | 32f725d32f8e15f9bd4d0607251ede14c38fd993 (patch) | |
tree | f217d7475fabf7353e1738213cf7025bbc22c6c5 /tests/unit_tests/logging.cpp | |
parent | Merge pull request #5861 (diff) | |
download | monero-32f725d32f8e15f9bd4d0607251ede14c38fd993.tar.xz |
Properly format multiline logs
As a side effect, colouring on Windows should now work
regardless of version
Diffstat (limited to 'tests/unit_tests/logging.cpp')
-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(); +} + |