From f8b1c1af17750189b83c58f360c85268c0d95105 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Fri, 28 Dec 2018 06:03:51 -0500 Subject: Googletest export Remove the #ifs for old, unsupported and buggy compilers: * old versions of GCC & MSVC * Symbian PiperOrigin-RevId: 227116941 --- googlemock/src/gmock-internal-utils.cc | 3 --- googlemock/src/gmock-spec-builders.cc | 3 --- 2 files changed, 6 deletions(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc index 937d830a..15946623 100644 --- a/googlemock/src/gmock-internal-utils.cc +++ b/googlemock/src/gmock-internal-utils.cc @@ -154,9 +154,6 @@ GTEST_API_ void Log(LogSeverity severity, const std::string& message, // Ensures that logs from different threads don't interleave. MutexLock l(&g_log_mutex); - // "using ::std::cout;" doesn't work with Symbian's STLport, where cout is a - // macro. - if (severity == kWarning) { // Prints a GMOCK WARNING marker to make the warnings easily searchable. std::cout << "\nGMOCK WARNING:"; diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index 5db774ed..b3d0cca2 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -592,9 +592,6 @@ class MockObjectRegistry { // object alive. Therefore we report any living object as test // failure, unless the user explicitly asked us to ignore it. ~MockObjectRegistry() { - // "using ::std::cout;" doesn't work with Symbian's STLport, where cout is - // a macro. - if (!GMOCK_FLAG(catch_leaked_mocks)) return; -- cgit v1.2.3 From 14c2fba7349e1f84e506dd6eab2835a8023d0f05 Mon Sep 17 00:00:00 2001 From: misterg Date: Wed, 2 Jan 2019 16:50:02 -0500 Subject: Googletest export Internal Change PiperOrigin-RevId: 227575279 --- googlemock/src/gmock-spec-builders.cc | 3 --- googlemock/src/gmock.cc | 3 --- 2 files changed, 6 deletions(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index b3d0cca2..ee0c5341 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -790,9 +790,6 @@ void Mock::RegisterUseByOnCallOrExpectCall(const void* mock_obj, const TestInfo* const test_info = UnitTest::GetInstance()->current_test_info(); if (test_info != nullptr) { - // FIXME: record the test case name when the - // ON_CALL or EXPECT_CALL is invoked from SetUpTestCase() or - // TearDownTestCase(). state.first_used_test_case = test_info->test_case_name(); state.first_used_test = test_info->name(); } diff --git a/googlemock/src/gmock.cc b/googlemock/src/gmock.cc index 675e8db8..3fd2e939 100644 --- a/googlemock/src/gmock.cc +++ b/googlemock/src/gmock.cc @@ -33,9 +33,6 @@ namespace testing { -// FIXME: support using environment variables to -// control the flag values, like what Google Test does. - GMOCK_DEFINE_bool_(catch_leaked_mocks, true, "true iff Google Mock should report leaked mock objects " "as failures."); -- cgit v1.2.3 From 4d62b5b9aef027a8c4f4432ecc661de0b87b4f46 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 3 Jan 2019 12:12:19 -0600 Subject: fix: Remove Arduino entry points Improved flexibility by removing the Arduino entry points in favor of manual calls to setup/loop that the user can call from their entry point. This is the more common use case for Arudino. Also added the gtest/gmock_main files to the PlatformIO ignore list since we are not supporting that feature. --- googlemock/src/gmock_main.cc | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc index db35bc37..a3a271e6 100644 --- a/googlemock/src/gmock_main.cc +++ b/googlemock/src/gmock_main.cc @@ -32,22 +32,6 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#ifdef ARDUINO -void setup() { - // Since Arduino doesn't have a command line, fake out the argc/argv arguments - int argc = 1; - const auto arg0 = "PlatformIO"; - char* argv0 = const_cast(arg0); - char** argv = &argv0; - - // Since Google Mock depends on Google Test, InitGoogleMock() is - // also responsible for initializing Google Test. Therefore there's - // no need for calling testing::InitGoogleTest() separately. - testing::InitGoogleMock(&argc, argv); -} -void loop() { RUN_ALL_TESTS(); } -#else - // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which // causes a link error when _tmain is defined in a static library and UNICODE // is enabled. For this reason instead of _tmain, main function is used on @@ -68,4 +52,3 @@ GTEST_API_ int main(int argc, char** argv) { testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); } -#endif -- cgit v1.2.3 From 3a460a26b7a91abf87af7f31b93d29f930e25c82 Mon Sep 17 00:00:00 2001 From: misterg Date: Thu, 3 Jan 2019 12:39:44 -0500 Subject: Googletest export TestCase->TestSuite refactoring PiperOrigin-RevId: 227702164 --- googlemock/src/gmock-spec-builders.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index ee0c5341..19714159 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -572,7 +572,7 @@ struct MockObjectState { // invoked on this mock object. const char* first_used_file; int first_used_line; - ::std::string first_used_test_case; + ::std::string first_used_test_suite; ::std::string first_used_test; bool leakable; // true iff it's OK to leak the object. FunctionMockers function_mockers; // All registered methods of the object. @@ -609,8 +609,8 @@ class MockObjectRegistry { state.first_used_line); std::cout << " ERROR: this mock object"; if (state.first_used_test != "") { - std::cout << " (used in test " << state.first_used_test_case << "." - << state.first_used_test << ")"; + std::cout << " (used in test " << state.first_used_test_suite << "." + << state.first_used_test << ")"; } std::cout << " should be deleted but never is. Its address is @" << it->first << "."; @@ -790,7 +790,7 @@ void Mock::RegisterUseByOnCallOrExpectCall(const void* mock_obj, const TestInfo* const test_info = UnitTest::GetInstance()->current_test_info(); if (test_info != nullptr) { - state.first_used_test_case = test_info->test_case_name(); + state.first_used_test_suite = test_info->test_suite_name(); state.first_used_test = test_info->name(); } } -- cgit v1.2.3 From 45c58aa6f3608224975f433e1f4e4b53aa34f97c Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 7 Jan 2019 12:37:34 -0600 Subject: fix: Add Arduino setup()/loop() functions back Added setup()/loop() functions back to *_main.cc files to support compiling in CI. Future features could enable this for the end user. --- googlemock/src/gmock_main.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc index a3a271e6..3306ffcf 100644 --- a/googlemock/src/gmock_main.cc +++ b/googlemock/src/gmock_main.cc @@ -32,6 +32,18 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#ifdef ARDUINO +void setup() { + int argc = 0; + char** argv = nullptr; + // Since Google Mock depends on Google Test, InitGoogleMock() is + // also responsible for initializing Google Test. Therefore there's + // no need for calling testing::InitGoogleTest() separately. + testing::InitGoogleMock(&argc, argv); +} +void loop() { RUN_ALL_TESTS(); } +#else + // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which // causes a link error when _tmain is defined in a static library and UNICODE // is enabled. For this reason instead of _tmain, main function is used on @@ -52,3 +64,5 @@ GTEST_API_ int main(int argc, char** argv) { testing::InitGoogleMock(&argc, argv); return RUN_ALL_TESTS(); } + +#endif -- cgit v1.2.3 From 5ed950c9e39cff044e84ca27d1b6919fa8dd7148 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Wed, 19 Jun 2019 16:48:38 -0400 Subject: Renaming doc files to make the file names more palatable and in preparation for including documentation in sync process --- googlemock/src/gmock-spec-builders.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index 19714159..ea8e1736 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -292,7 +292,7 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) { "an EXPECT_CALL() if you don't mean to enforce the call. " "See " "https://github.com/google/googletest/blob/master/googlemock/" - "docs/CookBook.md#" + "docs/cook_book.md#" "knowing-when-to-expect for details.\n", stack_frames_to_skip); break; -- cgit v1.2.3 From e4f097b5fbba8223b75cb4ff7394958c5aa410d7 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Wed, 10 Jul 2019 18:26:15 -0400 Subject: Googletest export Update a broken link in a comment. PiperOrigin-RevId: 257493975 --- googlemock/src/gmock-spec-builders.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index ea8e1736..19714159 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -292,7 +292,7 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) { "an EXPECT_CALL() if you don't mean to enforce the call. " "See " "https://github.com/google/googletest/blob/master/googlemock/" - "docs/cook_book.md#" + "docs/CookBook.md#" "knowing-when-to-expect for details.\n", stack_frames_to_skip); break; -- cgit v1.2.3 From 3d9cdd5803cecfbc68697b1f9f53eb99f085e4d4 Mon Sep 17 00:00:00 2001 From: misterg Date: Tue, 16 Jul 2019 13:07:54 -0400 Subject: Googletest export Fix documentation links PiperOrigin-RevId: 258389329 --- googlemock/src/gmock-spec-builders.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index 19714159..ea8e1736 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -292,7 +292,7 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) { "an EXPECT_CALL() if you don't mean to enforce the call. " "See " "https://github.com/google/googletest/blob/master/googlemock/" - "docs/CookBook.md#" + "docs/cook_book.md#" "knowing-when-to-expect for details.\n", stack_frames_to_skip); break; -- cgit v1.2.3 From bf6df7eaee5cfaafe2655fab143f348eba98c9af Mon Sep 17 00:00:00 2001 From: Krystian Kuzniarek Date: Fri, 26 Jul 2019 11:48:08 +0200 Subject: fix typos --- googlemock/src/gmock-internal-utils.cc | 4 ++-- googlemock/src/gmock-spec-builders.cc | 10 +++++----- googlemock/src/gmock.cc | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'googlemock/src') diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc index 15946623..1292e1d8 100644 --- a/googlemock/src/gmock-internal-utils.cc +++ b/googlemock/src/gmock-internal-utils.cc @@ -123,7 +123,7 @@ GTEST_API_ FailureReporterInterface* GetFailureReporter() { // Protects global resources (stdout in particular) used by Log(). static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex); -// Returns true iff a log with the given severity is visible according +// Returns true if a log with the given severity is visible according // to the --gmock_verbose flag. GTEST_API_ bool LogIsVisible(LogSeverity severity) { if (GMOCK_FLAG(verbose) == kInfoVerbosity) { @@ -139,7 +139,7 @@ GTEST_API_ bool LogIsVisible(LogSeverity severity) { } } -// Prints the given message to stdout iff 'severity' >= the level +// Prints the given message to stdout if 'severity' >= the level // specified by the --gmock_verbose flag. If stack_frames_to_skip >= // 0, also prints the stack trace excluding the top // stack_frames_to_skip frames. In opt mode, any positive diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc index ea8e1736..f6705a32 100644 --- a/googlemock/src/gmock-spec-builders.cc +++ b/googlemock/src/gmock-spec-builders.cc @@ -126,7 +126,7 @@ void ExpectationBase::RetireAllPreRequisites() } } -// Returns true iff all pre-requisites of this expectation have been +// Returns true if all pre-requisites of this expectation have been // satisfied. bool ExpectationBase::AllPrerequisitesAreSatisfied() const GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) { @@ -384,7 +384,7 @@ UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith( const CallReaction reaction = Mock::GetReactionOnUninterestingCalls(MockObject()); - // True iff we need to print this call's arguments and return + // True if we need to print this call's arguments and return // value. This definition must be kept in sync with // the behavior of ReportUninterestingCall(). const bool need_to_report_uninteresting_call = @@ -435,7 +435,7 @@ UntypedActionResultHolderBase* UntypedFunctionMockerBase::UntypedInvokeWith( &ss, &why); const bool found = untyped_expectation != nullptr; - // True iff we need to print the call's arguments and return value. + // True if we need to print the call's arguments and return value. // This definition must be kept in sync with the uses of Expect() // and Log() in this function. const bool need_to_report_call = @@ -574,7 +574,7 @@ struct MockObjectState { int first_used_line; ::std::string first_used_test_suite; ::std::string first_used_test; - bool leakable; // true iff it's OK to leak the object. + bool leakable; // true if it's OK to leak the object. FunctionMockers function_mockers; // All registered methods of the object. }; @@ -718,7 +718,7 @@ bool Mock::VerifyAndClearExpectations(void* mock_obj) } // Verifies all expectations on the given mock object and clears its -// default actions and expectations. Returns true iff the +// default actions and expectations. Returns true if the // verification was successful. bool Mock::VerifyAndClear(void* mock_obj) GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex) { diff --git a/googlemock/src/gmock.cc b/googlemock/src/gmock.cc index 05566e2d..ce926f2d 100644 --- a/googlemock/src/gmock.cc +++ b/googlemock/src/gmock.cc @@ -34,7 +34,7 @@ namespace testing { GMOCK_DEFINE_bool_(catch_leaked_mocks, true, - "true iff Google Mock should report leaked mock objects " + "true if Google Mock should report leaked mock objects " "as failures."); GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity, -- cgit v1.2.3