Skip to content

Instantly share code, notes, and snippets.

@bburdette
Created June 6, 2020 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bburdette/aaffa0a4f69c7ab2f85e756be5217b6d to your computer and use it in GitHub Desktop.
Save bburdette/aaffa0a4f69c7ab2f85e756be5217b6d to your computer and use it in GitHub Desktop.
diff --git a/src/libutil/tests/logging.cc b/src/libutil/tests/logging.cc
index ac015a1..fbdc912 100644
--- a/src/libutil/tests/logging.cc
+++ b/src/libutil/tests/logging.cc
@@ -78,6 +78,8 @@ namespace nix {
}
TEST(logEI, loggingErrorOnTalkativeLevel) {
+ verbosity = lvlTalkative;
+
testing::internal::CaptureStderr();
logger->logEI({ .level = lvlTalkative,
@@ -86,11 +88,12 @@ namespace nix {
});
auto str = testing::internal::GetCapturedStderr();
- // XXX: why is this the empty string?
- ASSERT_STREQ(str.c_str(), "");
+ ASSERT_STREQ(str.c_str(), "\x1B[32;1mtalk:\x1B[0m\x1B[34;1m --- Talkative name -------------------------------- error-unit-test\x1B[0m\nTalkative description\n");
}
TEST(logEI, loggingErrorOnChattyLevel) {
+ verbosity = lvlChatty;
+
testing::internal::CaptureStderr();
logger->logEI({ .level = lvlChatty,
@@ -99,11 +102,12 @@ namespace nix {
});
auto str = testing::internal::GetCapturedStderr();
- // XXX: why is this the empty string?
- ASSERT_STREQ(str.c_str(), "");
+ ASSERT_STREQ(str.c_str(), "\x1B[32;1mchat:\x1B[0m\x1B[34;1m --- Chatty name ----------------------------------- error-unit-test\x1B[0m\nTalkative description\n");
}
TEST(logEI, loggingErrorOnDebugLevel) {
+ verbosity = lvlDebug;
+
testing::internal::CaptureStderr();
logger->logEI({ .level = lvlDebug,
@@ -112,11 +116,12 @@ namespace nix {
});
auto str = testing::internal::GetCapturedStderr();
- // XXX: why is this the empty string?
- ASSERT_STREQ(str.c_str(), "");
+ ASSERT_STREQ(str.c_str(), "\x1B[33;1mdebug:\x1B[0m\x1B[34;1m --- Debug name ----------------------------------- error-unit-test\x1B[0m\nDebug description\n");
}
TEST(logEI, loggingErrorOnVomitLevel) {
+ verbosity = lvlVomit;
+
testing::internal::CaptureStderr();
logger->logEI({ .level = lvlVomit,
@@ -125,8 +130,7 @@ namespace nix {
});
auto str = testing::internal::GetCapturedStderr();
- // XXX: why is this the empty string?
- ASSERT_STREQ(str.c_str(), "");
+ ASSERT_STREQ(str.c_str(), "\x1B[32;1mvomit:\x1B[0m\x1B[34;1m --- Vomit name ----------------------------------- error-unit-test\x1B[0m\nVomit description\n");
}
/* ----------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment