Skip to content

Commit

Permalink
Misc. adjustments to unit tests for logging.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 704719961
Change-Id: I1a20823462a1af8aeae7498a3c511578efe487be
  • Loading branch information
Abseil Team authored and copybara-github committed Dec 10, 2024
1 parent 9e3b68a commit 4528747
Show file tree
Hide file tree
Showing 5 changed files with 436 additions and 447 deletions.
31 changes: 12 additions & 19 deletions absl/log/log_basic_test_impl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ TEST_P(BasicLogTest, Info) {
ENCODED_MESSAGE(MatchesEvent(
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::INFO), Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))));
}

Expand Down Expand Up @@ -142,7 +142,7 @@ TEST_P(BasicLogTest, Warning) {
ENCODED_MESSAGE(MatchesEvent(
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::WARNING), Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))));
}

Expand Down Expand Up @@ -173,7 +173,7 @@ TEST_P(BasicLogTest, Error) {
ENCODED_MESSAGE(MatchesEvent(
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::ERROR), Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))));
}

Expand Down Expand Up @@ -226,8 +226,7 @@ TEST_P(BasicLogDeathTest, Fatal) {
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::FATAL),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(
R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))))
.WillOnce(DeathTestExpectedLogging());

Expand All @@ -246,8 +245,7 @@ TEST_P(BasicLogDeathTest, Fatal) {
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::FATAL),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(
R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(Not(IsEmpty())))))
.WillOnce(DeathTestExpectedLogging());
}
Expand Down Expand Up @@ -288,8 +286,7 @@ TEST_P(BasicLogDeathTest, QFatal) {
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::FATAL),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(
R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))))
.WillOnce(DeathTestExpectedLogging());
}
Expand Down Expand Up @@ -325,7 +322,7 @@ TEST_P(BasicLogTest, DFatal) {
ENCODED_MESSAGE(MatchesEvent(
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::ERROR), Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))));
}

Expand Down Expand Up @@ -368,8 +365,7 @@ TEST_P(BasicLogDeathTest, DFatal) {
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::FATAL),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(
R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))))
.WillOnce(DeathTestExpectedLogging());

Expand All @@ -388,8 +384,7 @@ TEST_P(BasicLogDeathTest, DFatal) {
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::FATAL),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(
R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(Not(IsEmpty())))))
.WillOnce(DeathTestExpectedLogging());
}
Expand Down Expand Up @@ -454,7 +449,7 @@ TEST_P(BasicLogTest, Level) {
? logging::proto::ERROR
: 0),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))));
}
test_sink.StartCapturingLogs();
Expand Down Expand Up @@ -500,8 +495,7 @@ TEST_P(BasicLogDeathTest, Level) {
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::FATAL),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(
R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(IsEmpty()))))
.WillOnce(DeathTestExpectedLogging());

Expand All @@ -519,8 +513,7 @@ TEST_P(BasicLogDeathTest, Level) {
Eq(__FILE__), Eq(log_line), InMatchWindow(),
Eq(logging::proto::FATAL),
Eq(absl::base_internal::GetTID()),
ElementsAre(EqualsProto(
R"pb(literal: "hello world")pb")))),
ElementsAre(ValueWithLiteral(Eq("hello world"))))),
Stacktrace(Not(IsEmpty())))))
.WillOnce(DeathTestExpectedLogging());
}
Expand Down
Loading

0 comments on commit 4528747

Please sign in to comment.