Merge 1f32636560
into 445e9bd8d0
This commit is contained in:
commit
a26651735b
@ -301,6 +301,8 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) {
|
|||||||
"knowing-when-to-expect-useoncall for details.\n",
|
"knowing-when-to-expect-useoncall for details.\n",
|
||||||
stack_frames_to_skip);
|
stack_frames_to_skip);
|
||||||
break;
|
break;
|
||||||
|
case kFail:
|
||||||
|
[[fallthrough]];
|
||||||
default: // FAIL
|
default: // FAIL
|
||||||
Expect(false, nullptr, -1, msg);
|
Expect(false, nullptr, -1, msg);
|
||||||
}
|
}
|
||||||
|
@ -3263,6 +3263,8 @@ static const char* GetAnsiColorCode(GTestColor color) {
|
|||||||
return "2";
|
return "2";
|
||||||
case GTestColor::kYellow:
|
case GTestColor::kYellow:
|
||||||
return "3";
|
return "3";
|
||||||
|
case GTestColor::kDefault:
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
return "9";
|
return "9";
|
||||||
@ -3518,6 +3520,12 @@ void PrettyUnitTestResultPrinter::OnTestPartResult(
|
|||||||
// If the test part succeeded, we don't need to do anything.
|
// If the test part succeeded, we don't need to do anything.
|
||||||
case TestPartResult::kSuccess:
|
case TestPartResult::kSuccess:
|
||||||
return;
|
return;
|
||||||
|
case TestPartResult::kNonFatalFailure:
|
||||||
|
[[fallthrough]];
|
||||||
|
case TestPartResult::kFatalFailure:
|
||||||
|
[[fallthrough]];
|
||||||
|
case TestPartResult::kSkip:
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
// Print failure message from the assertion
|
// Print failure message from the assertion
|
||||||
// (e.g. expected this and got that).
|
// (e.g. expected this and got that).
|
||||||
@ -3736,6 +3744,12 @@ void BriefUnitTestResultPrinter::OnTestPartResult(
|
|||||||
// If the test part succeeded, we don't need to do anything.
|
// If the test part succeeded, we don't need to do anything.
|
||||||
case TestPartResult::kSuccess:
|
case TestPartResult::kSuccess:
|
||||||
return;
|
return;
|
||||||
|
case TestPartResult::kNonFatalFailure:
|
||||||
|
[[fallthrough]];
|
||||||
|
case TestPartResult::kFatalFailure:
|
||||||
|
[[fallthrough]];
|
||||||
|
case TestPartResult::kSkip:
|
||||||
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
// Print failure message from the assertion
|
// Print failure message from the assertion
|
||||||
// (e.g. expected this and got that).
|
// (e.g. expected this and got that).
|
||||||
|
@ -154,7 +154,7 @@ TEST_F(StreamingListenerTest, OnTestEnd) {
|
|||||||
EXPECT_EQ("event=TestEnd&passed=1&elapsed_time=0ms\n", *output());
|
EXPECT_EQ("event=TestEnd&passed=1&elapsed_time=0ms\n", *output());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(StreamingListenerTest, OnTestPartResult) {
|
TEST_F(StreamingListenerTest, OnTestPartResultWithFatalFailure) {
|
||||||
*output() = "";
|
*output() = "";
|
||||||
streamer_.OnTestPartResult(TestPartResult(TestPartResult::kFatalFailure,
|
streamer_.OnTestPartResult(TestPartResult(TestPartResult::kFatalFailure,
|
||||||
"foo.cc", 42, "failed=\n&%"));
|
"foo.cc", 42, "failed=\n&%"));
|
||||||
@ -165,6 +165,27 @@ TEST_F(StreamingListenerTest, OnTestPartResult) {
|
|||||||
*output());
|
*output());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(StreamingListenerTest, OnTestPartResultWithNonFatalFailure) {
|
||||||
|
*output() = "";
|
||||||
|
streamer_.OnTestPartResult(TestPartResult(
|
||||||
|
TestPartResult::kNonFatalFailure, "foo.cc", 42, "failed=\n&%"));
|
||||||
|
|
||||||
|
// Meta characters in the failure message should be properly escaped.
|
||||||
|
EXPECT_EQ(
|
||||||
|
"event=TestPartResult&file=foo.cc&line=42&message=failed%3D%0A%26%25\n",
|
||||||
|
*output());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(StreamingListenerTest, OnTestPartResultWithSkip) {
|
||||||
|
*output() = "";
|
||||||
|
streamer_.OnTestPartResult(TestPartResult(
|
||||||
|
TestPartResult::kSkip, "foo.cc", 42, "failed=\n&%"));
|
||||||
|
|
||||||
|
// Meta characters in the failure message should be properly escaped.
|
||||||
|
EXPECT_EQ(
|
||||||
|
"event=TestPartResult&file=foo.cc&line=42&message=failed%3D%0A%26%25\n",
|
||||||
|
*output());
|
||||||
|
}
|
||||||
#endif // GTEST_CAN_STREAM_RESULTS_
|
#endif // GTEST_CAN_STREAM_RESULTS_
|
||||||
|
|
||||||
// Provides access to otherwise private parts of the TestEventListeners class
|
// Provides access to otherwise private parts of the TestEventListeners class
|
||||||
|
Loading…
Reference in New Issue
Block a user