aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2010-08-31 18:28:02 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2010-08-31 18:28:02 +0000
commit2516f60da9073f3b04c0bbfc37d3aefffe11767e (patch)
treeb7ce61b652acc1b0401fed3804605f5b56543ff7
parentccedc1c93371e3b3826bc2d83b77ab1a26d07dc6 (diff)
downloadgoogletest-2516f60da9073f3b04c0bbfc37d3aefffe11767e.tar.gz
googletest-2516f60da9073f3b04c0bbfc37d3aefffe11767e.tar.bz2
googletest-2516f60da9073f3b04c0bbfc37d3aefffe11767e.zip
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).
-rw-r--r--msvc/gmock.vcproj8
-rw-r--r--msvc/gmock_test.vcproj4
-rw-r--r--src/gmock-internal-utils.cc10
-rw-r--r--test/gmock-internal-utils_test.cc8
-rw-r--r--test/gmock-nice-strict_test.cc8
-rw-r--r--test/gmock-spec-builders_test.cc16
6 files changed, 21 insertions, 33 deletions
diff --git a/msvc/gmock.vcproj b/msvc/gmock.vcproj
index b9036dad..39d9dc9e 100644
--- a/msvc/gmock.vcproj
+++ b/msvc/gmock.vcproj
@@ -163,10 +163,6 @@
>
</File>
<File
- RelativePath="..\src\gmock-printers.cc"
- >
- </File>
- <File
RelativePath="..\src\gmock-spec-builders.cc"
>
</File>
@@ -229,10 +225,6 @@
>
</File>
<File
- RelativePath="..\include\gmock\gmock-printers.h"
- >
- </File>
- <File
RelativePath="..\include\gmock\gmock-spec-builders.h"
>
</File>
diff --git a/msvc/gmock_test.vcproj b/msvc/gmock_test.vcproj
index 60e1b4bc..fd969d7c 100644
--- a/msvc/gmock_test.vcproj
+++ b/msvc/gmock_test.vcproj
@@ -223,10 +223,6 @@
>
</File>
<File
- RelativePath="..\test\gmock-printers_test.cc"
- >
- </File>
- <File
RelativePath="..\test\gmock_test.cc"
>
</File>
diff --git a/src/gmock-internal-utils.cc b/src/gmock-internal-utils.cc
index cc51836b..9debe187 100644
--- a/src/gmock-internal-utils.cc
+++ b/src/gmock-internal-utils.cc
@@ -57,14 +57,14 @@ string ConvertIdentifierNameToWords(const char* id_name) {
for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {
// We don't care about the current locale as the input is
// guaranteed to be a valid C++ identifier name.
- const bool starts_new_word = isupper(*p) ||
- (!isalpha(prev_char) && islower(*p)) ||
- (!isdigit(prev_char) && isdigit(*p));
+ const bool starts_new_word = IsUpper(*p) ||
+ (!IsAlpha(prev_char) && IsLower(*p)) ||
+ (!IsDigit(prev_char) && IsDigit(*p));
- if (isalnum(*p)) {
+ if (IsAlNum(*p)) {
if (starts_new_word && result != "")
result += ' ';
- result += static_cast<char>(tolower(*p));
+ result += ToLower(*p);
}
}
return result;
diff --git a/test/gmock-internal-utils_test.cc b/test/gmock-internal-utils_test.cc
index 4309f7c8..720d6c72 100644
--- a/test/gmock-internal-utils_test.cc
+++ b/test/gmock-internal-utils_test.cc
@@ -375,7 +375,7 @@ TEST_F(LogIsVisibleTest, WorksWhenVerbosityIsWarning) {
EXPECT_TRUE(LogIsVisible(WARNING));
}
-#if GTEST_HAS_STREAM_REDIRECTION_
+#if GTEST_HAS_STREAM_REDIRECTION
// Tests the Log() function.
@@ -458,7 +458,7 @@ TEST(LogTest, OnlyWarningsArePrintedWhenVerbosityIsInvalid) {
TestLogWithSeverity("invalid", WARNING, true);
}
-#endif // GTEST_HAS_STREAM_REDIRECTION_
+#endif // GTEST_HAS_STREAM_REDIRECTION
TEST(TypeTraitsTest, true_type) {
EXPECT_TRUE(true_type::value);
@@ -495,7 +495,7 @@ TEST(TypeTraitsTest, remove_reference) {
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
// and log severity.
@@ -572,7 +572,7 @@ TEST(OnCallTest, LogsAnythingArgument) {
HasSubstr("ON_CALL(mock, TestMethodArg(_)"));
}
-#endif // GTEST_HAS_STREAM_REDIRECTION_
+#endif // GTEST_HAS_STREAM_REDIRECTION
// Tests StlContainerView.
diff --git a/test/gmock-nice-strict_test.cc b/test/gmock-nice-strict_test.cc
index 0e52450d..f340cecb 100644
--- a/test/gmock-nice-strict_test.cc
+++ b/test/gmock-nice-strict_test.cc
@@ -57,10 +57,10 @@ using testing::HasSubstr;
using testing::NiceMock;
using testing::StrictMock;
-#if GTEST_HAS_STREAM_REDIRECTION_
+#if GTEST_HAS_STREAM_REDIRECTION
using testing::internal::CaptureStdout;
using testing::internal::GetCapturedStdout;
-#endif // GTEST_HAS_STREAM_REDIRECTION_
+#endif
// Defines some mock classes needed by the tests.
@@ -107,7 +107,7 @@ class 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.
TEST(NiceMockTest, NoWarningForUninterestingCall) {
@@ -151,7 +151,7 @@ TEST(NiceMockTest, InfoForUninterestingCall) {
GMOCK_FLAG(verbose) = saved_flag;
}
-#endif // GTEST_HAS_STREAM_REDIRECTION_
+#endif // GTEST_HAS_STREAM_REDIRECTION
// Tests that a nice mock allows expected calls.
TEST(NiceMockTest, AllowsExpectedCall) {
diff --git a/test/gmock-spec-builders_test.cc b/test/gmock-spec-builders_test.cc
index 1d0c491b..50af1fef 100644
--- a/test/gmock-spec-builders_test.cc
+++ b/test/gmock-spec-builders_test.cc
@@ -95,11 +95,11 @@ using testing::internal::kWarningVerbosity;
using testing::internal::String;
using testing::internal::string;
-#if GTEST_HAS_STREAM_REDIRECTION_
+#if GTEST_HAS_STREAM_REDIRECTION
using testing::HasSubstr;
using testing::internal::CaptureStdout;
using testing::internal::GetCapturedStdout;
-#endif // GTEST_HAS_STREAM_REDIRECTION_
+#endif
class Result {};
@@ -518,7 +518,7 @@ TEST(ExpectCallSyntaxTest, DefaultCardinalityIsOnce) {
}, "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
// WillOnce() is adequate.
@@ -643,7 +643,7 @@ TEST(ExpectCallSyntaxTest, WarnsOnTooFewActions) {
b.DoB();
}
-#endif // GTEST_HAS_STREAM_REDIRECTION_
+#endif // GTEST_HAS_STREAM_REDIRECTION
// Tests the semantics of ON_CALL().
@@ -797,7 +797,7 @@ TEST(ExpectCallTest, NthMatchTakesNthAction) {
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
// exhausted and there is no WillRepeatedly().
@@ -832,7 +832,7 @@ TEST(ExpectCallTest, TakesDefaultActionWhenWillListIsExhausted) {
" - returning default value."));
}
-#endif // GTEST_HAS_STREAM_REDIRECTION_
+#endif // GTEST_HAS_STREAM_REDIRECTION
// Tests that the WillRepeatedly() action is taken when the WillOnce(...)
// list is exhausted.
@@ -1802,7 +1802,7 @@ class VerboseFlagPreservingFixture : public testing::Test {
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
// containing the stack trace.
@@ -1979,7 +1979,7 @@ TEST_F(GMockVerboseFlagTest, InvalidFlagIsTreatedAsWarning) {
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
// ensure that Google Mock doesn't print a value (even to an internal