summaryrefslogtreecommitdiff
path: root/absl/log/log_macro_hygiene_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/log/log_macro_hygiene_test.cc')
-rw-r--r--absl/log/log_macro_hygiene_test.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/absl/log/log_macro_hygiene_test.cc b/absl/log/log_macro_hygiene_test.cc
index ab6461f5..dad9389e 100644
--- a/absl/log/log_macro_hygiene_test.cc
+++ b/absl/log/log_macro_hygiene_test.cc
@@ -139,6 +139,22 @@ TEST(LogHygieneTest, WorksWithINFODefined) {
#undef INFO
+#define _INFO Bogus
+TEST(LogHygieneTest, WorksWithUnderscoreINFODefined) {
+ absl::ScopedMockLog test_sink(absl::MockLogDefault::kDisallowUnexpected);
+
+ EXPECT_CALL(test_sink, Log(absl::LogSeverity::kInfo, _, "Hello world"))
+ .Times(2 + (IsOptimized ? 2 : 0));
+
+ test_sink.StartCapturingLogs();
+ LOG(INFO) << "Hello world";
+ LOG_IF(INFO, true) << "Hello world";
+
+ DLOG(INFO) << "Hello world";
+ DLOG_IF(INFO, true) << "Hello world";
+}
+#undef _INFO
+
TEST(LogHygieneTest, ExpressionEvaluationInLEVELSeverity) {
auto i = static_cast<int>(absl::LogSeverity::kInfo);
LOG(LEVEL(++i)) << "hello world"; // NOLINT