Publishes GTEST_HAS_STREAM_REDIRECTION (by Vlad Losev); casts char to unsigned char before calling isspace() etc to avoid undefined behavior (by Zhanyong Wan); fixes the VC projects (by Fredrik Roubert).
This commit is contained in:
parent
ccedc1c933
commit
2516f60da9
@ -162,10 +162,6 @@
|
|||||||
RelativePath="..\src\gmock-matchers.cc"
|
RelativePath="..\src\gmock-matchers.cc"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\src\gmock-printers.cc"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\gmock-spec-builders.cc"
|
RelativePath="..\src\gmock-spec-builders.cc"
|
||||||
>
|
>
|
||||||
@ -228,10 +224,6 @@
|
|||||||
RelativePath="..\include\gmock\gmock-matchers.h"
|
RelativePath="..\include\gmock\gmock-matchers.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\include\gmock\gmock-printers.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\include\gmock\gmock-spec-builders.h"
|
RelativePath="..\include\gmock\gmock-spec-builders.h"
|
||||||
>
|
>
|
||||||
|
@ -222,10 +222,6 @@
|
|||||||
RelativePath="..\test\gmock-port_test.cc"
|
RelativePath="..\test\gmock-port_test.cc"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\test\gmock-printers_test.cc"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\test\gmock_test.cc"
|
RelativePath="..\test\gmock_test.cc"
|
||||||
>
|
>
|
||||||
|
@ -57,14 +57,14 @@ string ConvertIdentifierNameToWords(const char* id_name) {
|
|||||||
for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {
|
for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {
|
||||||
// We don't care about the current locale as the input is
|
// We don't care about the current locale as the input is
|
||||||
// guaranteed to be a valid C++ identifier name.
|
// guaranteed to be a valid C++ identifier name.
|
||||||
const bool starts_new_word = isupper(*p) ||
|
const bool starts_new_word = IsUpper(*p) ||
|
||||||
(!isalpha(prev_char) && islower(*p)) ||
|
(!IsAlpha(prev_char) && IsLower(*p)) ||
|
||||||
(!isdigit(prev_char) && isdigit(*p));
|
(!IsDigit(prev_char) && IsDigit(*p));
|
||||||
|
|
||||||
if (isalnum(*p)) {
|
if (IsAlNum(*p)) {
|
||||||
if (starts_new_word && result != "")
|
if (starts_new_word && result != "")
|
||||||
result += ' ';
|
result += ' ';
|
||||||
result += static_cast<char>(tolower(*p));
|
result += ToLower(*p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -375,7 +375,7 @@ TEST_F(LogIsVisibleTest, WorksWhenVerbosityIsWarning) {
|
|||||||
EXPECT_TRUE(LogIsVisible(WARNING));
|
EXPECT_TRUE(LogIsVisible(WARNING));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests the Log() function.
|
// Tests the Log() function.
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ TEST(LogTest, OnlyWarningsArePrintedWhenVerbosityIsInvalid) {
|
|||||||
TestLogWithSeverity("invalid", WARNING, true);
|
TestLogWithSeverity("invalid", WARNING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
TEST(TypeTraitsTest, true_type) {
|
TEST(TypeTraitsTest, true_type) {
|
||||||
EXPECT_TRUE(true_type::value);
|
EXPECT_TRUE(true_type::value);
|
||||||
@ -495,7 +495,7 @@ TEST(TypeTraitsTest, remove_reference) {
|
|||||||
EXPECT_TRUE((type_equals<double*, remove_reference<double*>::type>::value));
|
EXPECT_TRUE((type_equals<double*, remove_reference<double*>::type>::value));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Verifies that Log() behaves correctly for the given verbosity level
|
// Verifies that Log() behaves correctly for the given verbosity level
|
||||||
// and log severity.
|
// and log severity.
|
||||||
@ -572,7 +572,7 @@ TEST(OnCallTest, LogsAnythingArgument) {
|
|||||||
HasSubstr("ON_CALL(mock, TestMethodArg(_)"));
|
HasSubstr("ON_CALL(mock, TestMethodArg(_)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests StlContainerView.
|
// Tests StlContainerView.
|
||||||
|
|
||||||
|
@ -57,10 +57,10 @@ using testing::HasSubstr;
|
|||||||
using testing::NiceMock;
|
using testing::NiceMock;
|
||||||
using testing::StrictMock;
|
using testing::StrictMock;
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
using testing::internal::CaptureStdout;
|
using testing::internal::CaptureStdout;
|
||||||
using testing::internal::GetCapturedStdout;
|
using testing::internal::GetCapturedStdout;
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif
|
||||||
|
|
||||||
// Defines some mock classes needed by the tests.
|
// Defines some mock classes needed by the tests.
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ class MockBar {
|
|||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests that a nice mock generates no warning for uninteresting calls.
|
// Tests that a nice mock generates no warning for uninteresting calls.
|
||||||
TEST(NiceMockTest, NoWarningForUninterestingCall) {
|
TEST(NiceMockTest, NoWarningForUninterestingCall) {
|
||||||
@ -151,7 +151,7 @@ TEST(NiceMockTest, InfoForUninterestingCall) {
|
|||||||
GMOCK_FLAG(verbose) = saved_flag;
|
GMOCK_FLAG(verbose) = saved_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests that a nice mock allows expected calls.
|
// Tests that a nice mock allows expected calls.
|
||||||
TEST(NiceMockTest, AllowsExpectedCall) {
|
TEST(NiceMockTest, AllowsExpectedCall) {
|
||||||
|
@ -95,11 +95,11 @@ using testing::internal::kWarningVerbosity;
|
|||||||
using testing::internal::String;
|
using testing::internal::String;
|
||||||
using testing::internal::string;
|
using testing::internal::string;
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
using testing::HasSubstr;
|
using testing::HasSubstr;
|
||||||
using testing::internal::CaptureStdout;
|
using testing::internal::CaptureStdout;
|
||||||
using testing::internal::GetCapturedStdout;
|
using testing::internal::GetCapturedStdout;
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif
|
||||||
|
|
||||||
class Result {};
|
class Result {};
|
||||||
|
|
||||||
@ -518,7 +518,7 @@ TEST(ExpectCallSyntaxTest, DefaultCardinalityIsOnce) {
|
|||||||
}, "to be called once");
|
}, "to be called once");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests that Google Mock doesn't print a warning when the number of
|
// Tests that Google Mock doesn't print a warning when the number of
|
||||||
// WillOnce() is adequate.
|
// WillOnce() is adequate.
|
||||||
@ -643,7 +643,7 @@ TEST(ExpectCallSyntaxTest, WarnsOnTooFewActions) {
|
|||||||
b.DoB();
|
b.DoB();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests the semantics of ON_CALL().
|
// Tests the semantics of ON_CALL().
|
||||||
|
|
||||||
@ -797,7 +797,7 @@ TEST(ExpectCallTest, NthMatchTakesNthAction) {
|
|||||||
EXPECT_EQ(3, b.DoB());
|
EXPECT_EQ(3, b.DoB());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests that the default action is taken when the WillOnce(...) list is
|
// Tests that the default action is taken when the WillOnce(...) list is
|
||||||
// exhausted and there is no WillRepeatedly().
|
// exhausted and there is no WillRepeatedly().
|
||||||
@ -832,7 +832,7 @@ TEST(ExpectCallTest, TakesDefaultActionWhenWillListIsExhausted) {
|
|||||||
" - returning default value."));
|
" - returning default value."));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests that the WillRepeatedly() action is taken when the WillOnce(...)
|
// Tests that the WillRepeatedly() action is taken when the WillOnce(...)
|
||||||
// list is exhausted.
|
// list is exhausted.
|
||||||
@ -1802,7 +1802,7 @@ class VerboseFlagPreservingFixture : public testing::Test {
|
|||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(VerboseFlagPreservingFixture);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(VerboseFlagPreservingFixture);
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION_
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Tests that an uninteresting mock function call generates a warning
|
// Tests that an uninteresting mock function call generates a warning
|
||||||
// containing the stack trace.
|
// containing the stack trace.
|
||||||
@ -1979,7 +1979,7 @@ TEST_F(GMockVerboseFlagTest, InvalidFlagIsTreatedAsWarning) {
|
|||||||
TestUninterestingCall(true);
|
TestUninterestingCall(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION_
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// A helper class that generates a failure when printed. We use it to
|
// A helper class that generates a failure when printed. We use it to
|
||||||
// ensure that Google Mock doesn't print a value (even to an internal
|
// ensure that Google Mock doesn't print a value (even to an internal
|
||||||
|
Loading…
Reference in New Issue
Block a user