Simplifies the implementation of GTEST_LOG_ & GTEST_LOG_; renames
GTEST_HIDE_UNREACHABLE_CODE_ to GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ (by Vlad Losev).
This commit is contained in:
@@ -143,7 +143,7 @@ class MayDie {
|
||||
// A member function that may die.
|
||||
void MemberFunction() const {
|
||||
if (should_die_) {
|
||||
GTEST_LOG_(FATAL, "death inside MayDie::MemberFunction().");
|
||||
GTEST_LOG_(FATAL) << "death inside MayDie::MemberFunction().";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,26 +154,26 @@ class MayDie {
|
||||
|
||||
// A global function that's expected to die.
|
||||
void GlobalFunction() {
|
||||
GTEST_LOG_(FATAL, "death inside GlobalFunction().");
|
||||
GTEST_LOG_(FATAL) << "death inside GlobalFunction().";
|
||||
}
|
||||
|
||||
// A non-void function that's expected to die.
|
||||
int NonVoidFunction() {
|
||||
GTEST_LOG_(FATAL, "death inside NonVoidFunction().");
|
||||
GTEST_LOG_(FATAL) << "death inside NonVoidFunction().";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// A unary function that may die.
|
||||
void DieIf(bool should_die) {
|
||||
if (should_die) {
|
||||
GTEST_LOG_(FATAL, "death inside DieIf().");
|
||||
GTEST_LOG_(FATAL) << "death inside DieIf().";
|
||||
}
|
||||
}
|
||||
|
||||
// A binary function that may die.
|
||||
bool DieIfLessThan(int x, int y) {
|
||||
if (x < y) {
|
||||
GTEST_LOG_(FATAL, "death inside DieIfLessThan().");
|
||||
GTEST_LOG_(FATAL) << "death inside DieIfLessThan().";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ void DeathTestSubroutine() {
|
||||
int DieInDebugElse12(int* sideeffect) {
|
||||
if (sideeffect) *sideeffect = 12;
|
||||
#ifndef NDEBUG
|
||||
GTEST_LOG_(FATAL, "debug death inside DieInDebugElse12()");
|
||||
GTEST_LOG_(FATAL) << "debug death inside DieInDebugElse12()";
|
||||
#endif // NDEBUG
|
||||
return 12;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user