From 008e54c1dd407b6edd680fccf78cd194365e0507 Mon Sep 17 00:00:00 2001 From: Martin Oberhuber Date: Sat, 5 Nov 2016 09:25:59 +0100 Subject: [PATCH 01/23] Fix #923 - support CMAKE_CROSSCOMPILING_EMULATOR for tests Replaced legacy syntax of cmake add_test() with more modern syntax. This allows running gtests's own tests on remote (cross) systems using CMAKE_CROSSCOMPILING_EMULATOR with cmake-3.3 or newer. --- googletest/cmake/internal_utils.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 8878dc1a..93b9e515 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -216,7 +216,7 @@ find_package(PythonInterp) # from the given source files with the given compiler flags. function(cxx_test_with_flags name cxx_flags libs) cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN}) - add_test(${name} ${name}) + add_test(NAME ${name} COMMAND ${name}) endfunction() # cxx_test(name libs srcs...) From db43df6df733c3b6c8a0a049e2000bb9869c5a8a Mon Sep 17 00:00:00 2001 From: Wiktor Garbacz Date: Thu, 9 Aug 2018 13:14:36 +0200 Subject: [PATCH 02/23] docs: fix broken links --- googletest/docs/advanced.md | 4 ++-- googletest/docs/faq.md | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md index feb8ad66..ffd94809 100644 --- a/googletest/docs/advanced.md +++ b/googletest/docs/advanced.md @@ -3,7 +3,7 @@ ## Introduction -Now that you have read the [googletest Primer](primer) and learned how to write +Now that you have read the [googletest Primer](primer.md) and learned how to write tests using googletest, it's time to learn some new tricks. This document will show you more assertions as well as how to construct complex failure messages, propagate fatal failures, reuse and speed up your test fixtures, and use various @@ -152,7 +152,7 @@ c is 10 > > 1. If you see a compiler error "no matching function to call" when using > `ASSERT_PRED*` or `EXPECT_PRED*`, please see -> [this](faq#OverloadedPredicate) for how to resolve it. +> [this](faq.md#OverloadedPredicate) for how to resolve it. > 1. Currently we only provide predicate assertions of arity <= 5. If you need > a higher-arity assertion, let [us](https://github.com/google/googletest/issues) know. diff --git a/googletest/docs/faq.md b/googletest/docs/faq.md index d613f7ba..7d42ff7d 100644 --- a/googletest/docs/faq.md +++ b/googletest/docs/faq.md @@ -707,8 +707,9 @@ In general, the recommended way to cause the code to behave differently under test is [Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection). You can inject different functionality from the test and from the production code. Since your production code doesn't link in the for-test logic at all (the -[`testonly`](http://go/testonly) attribute for BUILD targets helps to ensure -that), there is no danger in accidentally running it. +[`testonly`](https://docs.bazel.build/versions/master/be/common-definitions.html#common.testonly) +attribute for BUILD targets helps to ensure that), there is no danger in +accidentally running it. However, if you *really*, *really*, *really* have no choice, and if you follow the rule of ending your test program names with `_test`, you can use the From 063a90b391d475f8f7ddc12e1df3dabcaf643f79 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 10:51:49 -0400 Subject: [PATCH 03/23] Formatting change for auto code management, no functionality changes Merge branch 'master' of https://github.com/google/googletest --- googlemock/test/gmock_output_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googlemock/test/gmock_output_test.py b/googlemock/test/gmock_output_test.py index 8f57d46c..c8af0f96 100755 --- a/googlemock/test/gmock_output_test.py +++ b/googlemock/test/gmock_output_test.py @@ -33,9 +33,10 @@ To update the golden file: gmock_output_test.py --build_dir=BUILD/DIR --gengolden -# where BUILD/DIR contains the built gmock_output_test_ file. +where BUILD/DIR contains the built gmock_output_test_ file. gmock_output_test.py --gengolden gmock_output_test.py + """ __author__ = 'wan@google.com (Zhanyong Wan)' From ecc6944fb127be957185731e1dfbfd6eafb02d0e Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 11:12:12 -0400 Subject: [PATCH 04/23] Fixing identation, causes build errors when warnings are treated as errors --- googletest/src/gtest-death-test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index 564bcd27..22141183 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -238,8 +238,8 @@ static std::string DeathTestThreadWarning(size_t thread_count) { else msg << "detected " << thread_count << " threads."; msg << " See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#death-tests-and-threads" - << " for more explanation and suggested solutions, especially if" - << " this is the last message you see before your test times out."; + << " for more explanation and suggested solutions, especially if" + << " this is the last message you see before your test times out."; return msg.GetString(); } # endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA From d5b31df900802ba2651ebd51dfb1a0f83edae860 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 11:33:42 -0400 Subject: [PATCH 05/23] Update gtest-death-test.cc --- googletest/src/gtest-death-test.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index 22141183..9735df18 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -233,16 +233,18 @@ static std::string DeathTestThreadWarning(size_t thread_count) { Message msg; msg << "Death tests use fork(), which is unsafe particularly" << " in a threaded context. For this test, " << GTEST_NAME_ << " "; - if (thread_count == 0) + if (thread_count == 0) { msg << "couldn't detect the number of threads."; - else + } else { msg << "detected " << thread_count << " threads."; - msg << " See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#death-tests-and-threads" - << " for more explanation and suggested solutions, especially if" - << " this is the last message you see before your test times out."; + } + msg << " See " + "https://github.com/google/googletest/blob/master/googletest/docs/" + "advanced.md#death-tests-and-threads" + << " for more explanation and suggested solutions, especially if" + << " this is the last message you see before your test times out."; return msg.GetString(); -} -# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA +}# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // Flag characters for reporting a death test that did not die. static const char kDeathTestLived = 'L'; From f7042937af1b684c02145b0ddc6909e387caa81e Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 11:53:45 -0400 Subject: [PATCH 06/23] Fixing identation, causes build errors when warnings are treated as errors --- googletest/src/gtest-death-test.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index 22141183..854bc467 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -233,13 +233,16 @@ static std::string DeathTestThreadWarning(size_t thread_count) { Message msg; msg << "Death tests use fork(), which is unsafe particularly" << " in a threaded context. For this test, " << GTEST_NAME_ << " "; - if (thread_count == 0) + if (thread_count == 0) { msg << "couldn't detect the number of threads."; - else + } else { msg << "detected " << thread_count << " threads."; - msg << " See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#death-tests-and-threads" - << " for more explanation and suggested solutions, especially if" - << " this is the last message you see before your test times out."; + } + msg << " See " + "https://github.com/google/googletest/blob/master/googletest/docs/" + "advanced.md#death-tests-and-threads" + << " for more explanation and suggested solutions, especially if" + << " this is the last message you see before your test times out."; return msg.GetString(); } # endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA From 7a79459a663ce98a31fdbb14dea9a750bc285885 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 11:55:48 -0400 Subject: [PATCH 07/23] Fixing identation, causes build errors when warnings are treated as errors --- googletest/src/gtest-death-test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index 9735df18..854bc467 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -244,7 +244,8 @@ static std::string DeathTestThreadWarning(size_t thread_count) { << " for more explanation and suggested solutions, especially if" << " this is the last message you see before your test times out."; return msg.GetString(); -}# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA +} +# endif // !GTEST_OS_WINDOWS && !GTEST_OS_FUCHSIA // Flag characters for reporting a death test that did not die. static const char kDeathTestLived = 'L'; From 4d9411467dafe438a4ef04befed5ae3ae14f931a Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 12:21:49 -0400 Subject: [PATCH 08/23] code management comments, [ci-skip], no functionality changes --- googletest/include/gtest/internal/gtest-port.h | 2 ++ googletest/src/gtest.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 0a25ef3d..6fc9a80e 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -180,6 +180,7 @@ // GTEST_HAS_TYPED_TEST - typed tests // GTEST_HAS_TYPED_TEST_P - type-parameterized tests // GTEST_IS_THREADSAFE - Google Test is thread-safe. +// GOOGLETEST_CM0007 DO NOT DELETE // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. Do not confuse with // GTEST_HAS_POSIX_RE (see above) which users can // define themselves. @@ -231,6 +232,7 @@ // Regular expressions: // RE - a simple regular expression class using the POSIX // Extended Regular Expression syntax on UNIX-like platforms +// GOOGLETEST_CM0008 DO NOT DELETE // or a reduced regular exception syntax on other // platforms, including Windows. // Logging: diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index bc66c978..2ec36fa7 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -3590,6 +3590,7 @@ std::string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters( // The following routines generate an XML representation of a UnitTest // object. +// GOOGLETEST_CM0009 DO NOT DELETE // // This is how Google Test concepts map to the DTD: // From acaf5beaccf6cededfb741a1e67df0a497738265 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 13:37:11 -0400 Subject: [PATCH 09/23] formatting and small changes related to code management, no functionality changes --- googletest/test/googletest-output-test.py | 11 +++++------ googletest/test/gtest_test_utils.py | 8 +++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/googletest/test/googletest-output-test.py b/googletest/test/googletest-output-test.py index c1c36527..0dae8d12 100755 --- a/googletest/test/googletest-output-test.py +++ b/googletest/test/googletest-output-test.py @@ -31,12 +31,11 @@ """Tests the text output of Google C++ Testing and Mocking Framework. - -SYNOPSIS - googletest_output_test.py --build_dir=BUILD/DIR --gengolden - # where BUILD/DIR contains the built googletest-output-test_ file. - googletest_output_test.py --gengolden - googletest_output_test.py +To update the golden file: +googletest_output_test.py --build_dir=BUILD/DIR --gengolden +where BUILD/DIR contains the built googletest-output-test_ file. +googletest_output_test.py --gengolden +googletest_output_test.py """ __author__ = 'wan@google.com (Zhanyong Wan)' diff --git a/googletest/test/gtest_test_utils.py b/googletest/test/gtest_test_utils.py index d7fc0990..c4c02275 100755 --- a/googletest/test/gtest_test_utils.py +++ b/googletest/test/gtest_test_utils.py @@ -36,15 +36,13 @@ __author__ = 'wan@google.com (Zhanyong Wan)' import os import sys -IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux' IS_WINDOWS = os.name == 'nt' IS_CYGWIN = os.name == 'posix' and 'CYGWIN' in os.uname()[0] import atexit import shutil import tempfile -import unittest -_test_module = unittest +import unittest as _test_module try: import subprocess @@ -74,7 +72,7 @@ def SetEnvVar(env_var, value): # Here we expose a class from a particular module, depending on the # environment. The comment suppresses the 'Invalid variable name' lint # complaint. -TestCase = _test_module.TestCase # pylint: disable-msg=C6409 +TestCase = _test_module.TestCase # pylint: disable=C6409 # Initially maps a flag to its default value. After # _ParseAndStripGTestFlags() is called, maps a flag to its actual value. @@ -88,7 +86,7 @@ def _ParseAndStripGTestFlags(argv): # Suppresses the lint complaint about a global variable since we need it # here to maintain module-wide state. - global _gtest_flags_are_parsed # pylint: disable-msg=W0603 + global _gtest_flags_are_parsed # pylint: disable=W0603 if _gtest_flags_are_parsed: return From 5eb263569bc1f90ff3820c4f9f5fbc8fa25a031f Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Thu, 9 Aug 2018 15:24:43 -0400 Subject: [PATCH 10/23] Update gmock_output_test.py --- googlemock/test/gmock_output_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/test/gmock_output_test.py b/googlemock/test/gmock_output_test.py index c8af0f96..20323e17 100755 --- a/googlemock/test/gmock_output_test.py +++ b/googlemock/test/gmock_output_test.py @@ -29,7 +29,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -"""Tests the text output of Google C++ Mocking Framework. +r"""Tests the text output of Google C++ Mocking Framework. To update the golden file: gmock_output_test.py --build_dir=BUILD/DIR --gengolden From e821a2db235e67a66d9a88ea5c27316eb8d30cb7 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 10 Aug 2018 10:59:52 -0400 Subject: [PATCH 11/23] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index d87abce0..7ca381ec 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,13 @@ [![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest) [![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master) +**Future Plans**: +* Tagged Release 1.8.x. +** The 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" +* Post 1.8.x - work to remove C++98 support / cleanup code in the master branch. When this work is completed there will be a 1.9.0 tagged release +* Post 1.9.0 googletest will follow [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) + + Welcome to **Google Test**, Google's C++ test framework! This repository is a merger of the formerly separate GoogleTest and From 945618b2025b8f0b73f374f4b258e5df85c784a2 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 10 Aug 2018 11:06:52 -0400 Subject: [PATCH 12/23] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7ca381ec..d2f98ae8 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ **Future Plans**: * Tagged Release 1.8.x. ** The 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" -* Post 1.8.x - work to remove C++98 support / cleanup code in the master branch. When this work is completed there will be a 1.9.0 tagged release -* Post 1.9.0 googletest will follow [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) +* Post 1.8.x - work to remove C++98 support / cleanup code in the master branch. When this work is completed there will be a 1.9.x tagged release +* Post 1.9.x googletest will follow [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) Welcome to **Google Test**, Google's C++ test framework! From 4de527dc2cc28074513eea77495909de22df633a Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 10 Aug 2018 11:29:18 -0400 Subject: [PATCH 13/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d2f98ae8..90ea02c5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ **Future Plans**: * Tagged Release 1.8.x. ** The 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" -* Post 1.8.x - work to remove C++98 support / cleanup code in the master branch. When this work is completed there will be a 1.9.x tagged release +* Post 1.8.x - work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release * Post 1.9.x googletest will follow [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) From 77ac31c35f15980d9b54931404a4ada3285abead Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 10 Aug 2018 11:30:04 -0400 Subject: [PATCH 14/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 90ea02c5..8e343d27 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **Future Plans**: * Tagged Release 1.8.x. -** The 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" +The 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" * Post 1.8.x - work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release * Post 1.9.x googletest will follow [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) From b1236528fef2feba22cb0c8b371df8686e801456 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 10 Aug 2018 12:05:17 -0400 Subject: [PATCH 15/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e343d27..4886c92a 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master) **Future Plans**: -* Tagged Release 1.8.x. +* 1.8.x Release The 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" * Post 1.8.x - work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release * Post 1.9.x googletest will follow [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) From 8cccb2a718c3fbfa1742b0badd50b81f75de678e Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 10 Aug 2018 15:20:51 -0400 Subject: [PATCH 16/23] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 4886c92a..14a9e236 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ [![Build status](https://ci.appveyor.com/api/projects/status/4o38plt0xbo1ubc8/branch/master?svg=true)](https://ci.appveyor.com/project/GoogleTestAppVeyor/googletest/branch/master) **Future Plans**: -* 1.8.x Release -The 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" +* 1.8.x Release - the 1.8.x will be the last release that works with pre-C++11 compilers. The 1.8.1 will not accept any requests for any new features and any bugfix requests will only be accepted if proven "critical" * Post 1.8.x - work to improve/cleanup/pay technical debt. When this work is completed there will be a 1.9.x tagged release * Post 1.9.x googletest will follow [Abseil Live at Head philosophy](https://abseil.io/about/philosophy) From 390a6b79321757ca91544228f22ae9eb81ede44e Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 10 Aug 2018 15:42:16 -0400 Subject: [PATCH 17/23] Mode change on a python script --- googletest/test/gtest_testbridge_test.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 googletest/test/gtest_testbridge_test.py diff --git a/googletest/test/gtest_testbridge_test.py b/googletest/test/gtest_testbridge_test.py old mode 100644 new mode 100755 From ecc241900a1eae04d4b5f642cb8b3ebfc497d5e7 Mon Sep 17 00:00:00 2001 From: Yi Zheng Date: Mon, 13 Aug 2018 17:57:51 +0800 Subject: [PATCH 18/23] - Fix the broken markdown table - Fix some format issue --- googletest/docs/advanced.md | 94 +++++++++++++++---------------------- 1 file changed, 39 insertions(+), 55 deletions(-) diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md index ffd94809..0a92e524 100644 --- a/googletest/docs/advanced.md +++ b/googletest/docs/advanced.md @@ -103,13 +103,11 @@ If you already have a function or functor that returns `bool` (or a type that can be implicitly converted to `bool`), you can use it in a *predicate assertion* to get the function arguments printed for free: -| Fatal assertion | Nonfatal assertion | Verifies | -| -------------------- | -------------------- | --------------------------- | -| `ASSERT_PRED1(pred1, | `EXPECT_PRED1(pred1, | `pred1(val1)` is true | -: val1);` : val1);` : : -| `ASSERT_PRED2(pred2, | `EXPECT_PRED2(pred2, | `pred2(val1, val2)` is true | -: val1, val2);` : val1, val2);` : : -| `...` | `...` | ... | +| Fatal assertion | Nonfatal assertion | Verifies | +| ---------------------------------- | ---------------------------------- | --------------------------- | +| `ASSERT_PRED1(pred1, val1);` | `EXPECT_PRED1(pred1, val1);` | `pred1(val1)` is true | +| `ASSERT_PRED2(pred2, val1, val2);` | `EXPECT_PRED2(pred2, val1, val2);` | `pred2(val1, val2)` is true | +| `...` | `...` | ... | In the above, `predn` is an `n`-ary predicate function or functor, where `val1`, `val2`, ..., and `valn` are its arguments. The assertion succeeds if the @@ -120,7 +118,7 @@ either case, the arguments are evaluated exactly once. Here's an example. Given ```c++ -// Returns true iff m and n have no common divisors except 1. +// Returns true if m and n have no common divisors except 1. bool MutuallyPrime(int m, int n) { ... } const int a = 3; @@ -339,12 +337,10 @@ want to learn more, see #### Floating-Point Macros -| Fatal assertion | Nonfatal assertion | Verifies | -| ----------------------- | ----------------------- | ----------------------- | -| `ASSERT_FLOAT_EQ(val1, | `EXPECT_FLOAT_EQ(val1, | the two `float` values | -: val2);` : val2);` : are almost equal : -| `ASSERT_DOUBLE_EQ(val1, | `EXPECT_DOUBLE_EQ(val1, | the two `double` values | -: val2);` : val2);` : are almost equal : +| Fatal assertion | Nonfatal assertion | Verifies | +| ------------------------------- | ------------------------------ | ---------------------------------------- | +| `ASSERT_FLOAT_EQ(val1, val2);` | `EXPECT_FLOAT_EQ(val1,val2);` | the two `float` values are almost equal | +| `ASSERT_DOUBLE_EQ(val1, val2);` | `EXPECT_DOUBLE_EQ(val1, val2);`| the two `double` values are almost equal | By "almost equal" we mean the values are within 4 ULP's from each other. @@ -354,12 +350,9 @@ unsafe and has been deprecated. Please don't use it any more. The following assertions allow you to choose the acceptable error bound: -| Fatal assertion | Nonfatal assertion | Verifies | -| ------------------ | ------------------------ | ------------------------- | -| `ASSERT_NEAR(val1, | `EXPECT_NEAR(val1, val2, | the difference between | -: val2, abs_error);` : abs_error);` : `val1` and `val2` doesn't : -: : : exceed the given absolute : -: : : error : +| Fatal assertion | Nonfatal assertion | Verifies | +| ------------------------------------- | ------------------------------------- | ------------------------- | +| `ASSERT_NEAR(val1, val2, abs_error);` | `EXPECT_NEAR(val1, val2, abs_error);` | the difference between `val1` and `val2` doesn't exceed the given absolute error | **Availability**: Linux, Windows, Mac. @@ -387,10 +380,9 @@ library of matchers for validating arguments passed to mock objects. A gMock *matcher* is basically a predicate that knows how to describe itself. It can be used in these assertion macros: -| Fatal assertion | Nonfatal assertion | Verifies | -| ------------------- | ------------------------------ | --------------------- | -| `ASSERT_THAT(value, | `EXPECT_THAT(value, matcher);` | value matches matcher | -: matcher);` : : : +| Fatal assertion | Nonfatal assertion | Verifies | +| ------------------------------ | ------------------------------ | --------------------- | +| `ASSERT_THAT(value, matcher);` | `EXPECT_THAT(value, matcher);` | value matches matcher | For example, `StartsWith(prefix)` is a matcher that matches a string starting with `prefix`, and you can write: @@ -1396,17 +1388,11 @@ namespace: | Parameter Generator | Behavior | | ---------------------------- | ------------------------------------------- | -| `Range(begin, end [, step])` | Yields values `{begin, begin+step, | -: : begin+step+step, ...}`. The values do not : -: : include `end`. `step` defaults to 1. : +| `Range(begin, end [, step])` | Yields values `{begin, begin+step, begin+step+step, ...}`. The values do not include `end`. `step` defaults to 1. | | `Values(v1, v2, ..., vN)` | Yields values `{v1, v2, ..., vN}`. | -| `ValuesIn(container)` and | Yields values from a C-style array, an | -: `ValuesIn(begin,end)` : STL-style container, or an iterator range : -: : `[begin, end)`. : +| `ValuesIn(container)` and `ValuesIn(begin,end)` | Yields values from a C-style array, an STL-style container, or an iterator range `[begin, end)`. | | `Bool()` | Yields sequence `{false, true}`. | -| `Combine(g1, g2, ..., gN)` | Yields all combinations (Cartesian product) | -: : as std\:\:tuples of the values generated by : -: : the `N` generators. : +| `Combine(g1, g2, ..., gN)` | Yields all combinations (Cartesian product) as std\:\:tuples of the values generated by the `N` generators. | For more details, see the comments at the definitions of these functions. @@ -1726,11 +1712,11 @@ To test them, we use the following special techniques: ```c++ // foo.h -#include "gtest/gtest_prod.h" + #include "gtest/gtest_prod.h" class Foo { ... - private: + private: FRIEND_TEST(FooTest, BarReturnsZeroOnNull); int Bar(void* x); @@ -1779,7 +1765,7 @@ To test them, we use the following special techniques: ``` - ## "Catching" Failures +## "Catching" Failures If you are building a testing utility on top of googletest, you'll want to test your utility. What framework would you use to test it? googletest, of course. @@ -2168,23 +2154,22 @@ random seed and re-shuffle the tests in each iteration. googletest can use colors in its terminal output to make it easier to spot the important information: -... -[----------] 1 test from FooTest -[ RUN ] FooTest.DoesAbc -[ OK ] FooTest.DoesAbc -[----------] 2 tests from BarTest -[ RUN ] BarTest.HasXyzProperty -[ OK ] BarTest.HasXyzProperty -[ RUN ] BarTest.ReturnsTrueOnSuccess -... some error messages ... -[ FAILED ] BarTest.ReturnsTrueOnSuccess -... -[==========] 30 tests from 14 test cases ran. -[ PASSED ] 28 tests. -[ FAILED ] 2 tests, listed below: -[ FAILED ] BarTest.ReturnsTrueOnSuccess -[ FAILED ] AnotherTest.DoesXyz - +...
+[----------] 1 test from FooTest
+[ RUN ] FooTest.DoesAbc
+[ OK ] FooTest.DoesAbc
+[----------] 2 tests from BarTest
+[ RUN ] BarTest.HasXyzProperty
+[ OK ] BarTest.HasXyzProperty
+[ RUN ] BarTest.ReturnsTrueOnSuccess
+... some error messages ...
+[ FAILED ] BarTest.ReturnsTrueOnSuccess
+...
+[==========] 30 tests from 14 test cases ran.
+[ PASSED ] 28 tests.
+[ FAILED ] 2 tests, listed below:
+[ FAILED ] BarTest.ReturnsTrueOnSuccess
+[ FAILED ] AnotherTest.DoesXyz
2 FAILED TESTS You can set the `GTEST_COLOR` environment variable or the `--gtest_color` @@ -2193,8 +2178,7 @@ disable colors, or let googletest decide. When the value is `auto`, googletest will use colors if and only if the output goes to a terminal and (on non-Windows platforms) the `TERM` environment variable is set to `xterm` or `xterm-color`. -> -> **Availability**: Linux, Windows, Mac. + **Availability**: Linux, Windows, Mac. #### Suppressing the Elapsed Time From 18c940d13a58a3fa1016d2887e66bd1c73720e0f Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 13 Aug 2018 13:17:38 -0400 Subject: [PATCH 19/23] comment cleanup --- googlemock/include/gmock/internal/custom/gmock-matchers.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/googlemock/include/gmock/internal/custom/gmock-matchers.h b/googlemock/include/gmock/internal/custom/gmock-matchers.h index b9b7e3f8..227d91f6 100644 --- a/googlemock/include/gmock/internal/custom/gmock-matchers.h +++ b/googlemock/include/gmock/internal/custom/gmock-matchers.h @@ -31,8 +31,6 @@ // An installation-specific extension point for gmock-matchers.h. // ============================================================ // -// Adds google3 callback support to CallableTraits. - // GOOGLETEST_CM0002 DO NOT DELETE #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ From 63baab8924f589fdfd934ae24613e59f8d3ef635 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 13 Aug 2018 14:31:56 -0400 Subject: [PATCH 20/23] Move instructions into custom/README files --- .../include/gmock/internal/custom/README.md | 16 ++++++ .../gmock/internal/custom/gmock-matchers.h | 4 +- .../gmock/internal/custom/gmock-port.h | 11 +--- .../include/gtest/internal/custom/README.md | 56 +++++++++++++++++++ .../gtest/internal/custom/gtest-port.h | 35 +----------- .../gtest/internal/custom/gtest-printers.h | 4 +- .../include/gtest/internal/custom/gtest.h | 10 +--- 7 files changed, 78 insertions(+), 58 deletions(-) create mode 100644 googlemock/include/gmock/internal/custom/README.md create mode 100644 googletest/include/gtest/internal/custom/README.md diff --git a/googlemock/include/gmock/internal/custom/README.md b/googlemock/include/gmock/internal/custom/README.md new file mode 100644 index 00000000..ef5f9bf4 --- /dev/null +++ b/googlemock/include/gmock/internal/custom/README.md @@ -0,0 +1,16 @@ +# Customization Points + +The custom directory is an injection point for custom user configurations. + +## Header gmock-port.h + +The following macros can be defined: + +### Flag related macros: + +* GMOCK_DECLARE_bool_(name) +* GMOCK_DECLARE_int32_(name) +* GMOCK_DECLARE_string_(name) +* GMOCK_DEFINE_bool_(name, default_val, doc) +* GMOCK_DEFINE_int32_(name, default_val, doc) +* GMOCK_DEFINE_string_(name, default_val, doc) diff --git a/googlemock/include/gmock/internal/custom/gmock-matchers.h b/googlemock/include/gmock/internal/custom/gmock-matchers.h index 227d91f6..14aafaab 100644 --- a/googlemock/include/gmock/internal/custom/gmock-matchers.h +++ b/googlemock/include/gmock/internal/custom/gmock-matchers.h @@ -27,9 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// ============================================================ -// An installation-specific extension point for gmock-matchers.h. -// ============================================================ +// Injection point for custom user configurations. See README for details // // GOOGLETEST_CM0002 DO NOT DELETE diff --git a/googlemock/include/gmock/internal/custom/gmock-port.h b/googlemock/include/gmock/internal/custom/gmock-port.h index ad9ae36f..0030fe91 100644 --- a/googlemock/include/gmock/internal/custom/gmock-port.h +++ b/googlemock/include/gmock/internal/custom/gmock-port.h @@ -27,16 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Injection point for custom user configurations. -// The following macros can be defined: -// -// Flag related macros: -// GMOCK_DECLARE_bool_(name) -// GMOCK_DECLARE_int32_(name) -// GMOCK_DECLARE_string_(name) -// GMOCK_DEFINE_bool_(name, default_val, doc) -// GMOCK_DEFINE_int32_(name, default_val, doc) -// GMOCK_DEFINE_string_(name, default_val, doc) +// Injection point for custom user configurations. See README for details // // ** Custom implementation starts here ** diff --git a/googletest/include/gtest/internal/custom/README.md b/googletest/include/gtest/internal/custom/README.md new file mode 100644 index 00000000..e39b7c6e --- /dev/null +++ b/googletest/include/gtest/internal/custom/README.md @@ -0,0 +1,56 @@ +# Customization Points + +The custom directory is an injection point for custom user configurations. + +## Header gtest.h + +### The following macros can be defined: + +* GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of + OsStackTraceGetterInterface. +* GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir(). See + testing::TempDir for semantics and signature. + +## Header gtest-port.h + +The following macros can be defined: + +### Flag related macros: + +* GTEST_FLAG(flag_name) +* GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its own + flagfile flag parsing. +* GTEST_DECLARE_bool_(name) +* GTEST_DECLARE_int32_(name) +* GTEST_DECLARE_string_(name) * +* GTEST_DEFINE_bool_(name, default_val, doc) +* GTEST_DEFINE_int32_(name, default_val, doc) +* GTEST_DEFINE_string_(name, default_val, doc) + +### Logging: + +* GTEST_LOG_(severity) +* GTEST_CHECK_(condition) +* Functions LogToStderr() and FlushInfoLog() have to be provided too. + +### Threading: + +* GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided. +* GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are + already provided. Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and + GTEST_DEFINE_STATIC_MUTEX_(mutex) +* GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) +* GTEST_LOCK_EXCLUDED_(locks) + +### Underlying library support features + +* GTEST_HAS_CXXABI_H_ + +### Exporting API symbols: + +* GTEST_API_ - Specifier for exported symbols. + +## Header gtest-printers.h + +* See documentation at gtest/gtest-printers.h for details on how to define a + custom printer. diff --git a/googletest/include/gtest/internal/custom/gtest-port.h b/googletest/include/gtest/internal/custom/gtest-port.h index aa5da295..cd85d956 100644 --- a/googletest/include/gtest/internal/custom/gtest-port.h +++ b/googletest/include/gtest/internal/custom/gtest-port.h @@ -27,40 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Injection point for custom user configurations. -// The following macros can be defined: -// -// Flag related macros: -// GTEST_FLAG(flag_name) -// GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its -// own flagfile flag parsing. -// GTEST_DECLARE_bool_(name) -// GTEST_DECLARE_int32_(name) -// GTEST_DECLARE_string_(name) -// GTEST_DEFINE_bool_(name, default_val, doc) -// GTEST_DEFINE_int32_(name, default_val, doc) -// GTEST_DEFINE_string_(name, default_val, doc) -// -// Logging: -// GTEST_LOG_(severity) -// GTEST_CHECK_(condition) -// Functions LogToStderr() and FlushInfoLog() have to be provided too. -// -// Threading: -// GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided. -// GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are -// already provided. -// Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and -// GTEST_DEFINE_STATIC_MUTEX_(mutex) -// -// GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) -// GTEST_LOCK_EXCLUDED_(locks) -// -// Underlying library support features: -// GTEST_HAS_CXXABI_H_ -// -// Exporting API symbols: -// GTEST_API_ - Specifier for exported symbols. +// Injection point for custom user configurations. See README for details // // ** Custom implementation starts here ** diff --git a/googletest/include/gtest/internal/custom/gtest-printers.h b/googletest/include/gtest/internal/custom/gtest-printers.h index 60c1ea05..eb4467ab 100644 --- a/googletest/include/gtest/internal/custom/gtest-printers.h +++ b/googletest/include/gtest/internal/custom/gtest-printers.h @@ -31,8 +31,8 @@ // installation of gTest. // It will be included from gtest-printers.h and the overrides in this file // will be visible to everyone. -// See documentation at gtest/gtest-printers.h for details on how to define a -// custom printer. +// +// Injection point for custom user configurations. See README for details // // ** Custom implementation starts here ** diff --git a/googletest/include/gtest/internal/custom/gtest.h b/googletest/include/gtest/internal/custom/gtest.h index 6f7c5e40..4c8e07be 100644 --- a/googletest/include/gtest/internal/custom/gtest.h +++ b/googletest/include/gtest/internal/custom/gtest.h @@ -27,15 +27,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Injection point for custom user configurations. -// The following macros can be defined: -// -// GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of -// OsStackTraceGetterInterface. -// -// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir(). -// See testing::TempDir for semantics and -// signature. +// Injection point for custom user configurations. See README for details // // ** Custom implementation starts here ** From 9060e19c87d6a041b3f31b172b300a833cc28109 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 13 Aug 2018 16:23:17 -0400 Subject: [PATCH 21/23] formatting for new READMEs --- .../include/gmock/internal/custom/README.md | 12 ++--- .../include/gtest/internal/custom/README.md | 44 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/googlemock/include/gmock/internal/custom/README.md b/googlemock/include/gmock/internal/custom/README.md index ef5f9bf4..76969a7e 100644 --- a/googlemock/include/gmock/internal/custom/README.md +++ b/googlemock/include/gmock/internal/custom/README.md @@ -8,9 +8,9 @@ The following macros can be defined: ### Flag related macros: -* GMOCK_DECLARE_bool_(name) -* GMOCK_DECLARE_int32_(name) -* GMOCK_DECLARE_string_(name) -* GMOCK_DEFINE_bool_(name, default_val, doc) -* GMOCK_DEFINE_int32_(name, default_val, doc) -* GMOCK_DEFINE_string_(name, default_val, doc) +* `GMOCK_DECLARE_bool_(name)` +* `GMOCK_DECLARE_int32_(name)` +* `GMOCK_DECLARE_string_(name)` +* `GMOCK_DEFINE_bool_(name, default_val, doc)` +* `GMOCK_DEFINE_int32_(name, default_val, doc)` +* `GMOCK_DEFINE_string_(name, default_val, doc)` diff --git a/googletest/include/gtest/internal/custom/README.md b/googletest/include/gtest/internal/custom/README.md index e39b7c6e..3a2b8855 100644 --- a/googletest/include/gtest/internal/custom/README.md +++ b/googletest/include/gtest/internal/custom/README.md @@ -6,9 +6,9 @@ The custom directory is an injection point for custom user configurations. ### The following macros can be defined: -* GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of +* `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of OsStackTraceGetterInterface. -* GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir(). See +* `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for testing::TempDir(). See testing::TempDir for semantics and signature. ## Header gtest-port.h @@ -17,38 +17,38 @@ The following macros can be defined: ### Flag related macros: -* GTEST_FLAG(flag_name) -* GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its own - flagfile flag parsing. -* GTEST_DECLARE_bool_(name) -* GTEST_DECLARE_int32_(name) -* GTEST_DECLARE_string_(name) * -* GTEST_DEFINE_bool_(name, default_val, doc) -* GTEST_DEFINE_int32_(name, default_val, doc) -* GTEST_DEFINE_string_(name, default_val, doc) +* `GTEST_FLAG(flag_name)` +* `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its + own flagfile flag parsing. +* `GTEST_DECLARE_bool_(name)` +* `GTEST_DECLARE_int32_(name)` +* `GTEST_DECLARE_string_(name)` +* `GTEST_DEFINE_bool_(name, default_val, doc)` +* `GTEST_DEFINE_int32_(name, default_val, doc)` +* `GTEST_DEFINE_string_(name, default_val, doc)` ### Logging: -* GTEST_LOG_(severity) -* GTEST_CHECK_(condition) -* Functions LogToStderr() and FlushInfoLog() have to be provided too. +* `GTEST_LOG_(severity)` +* `GTEST_CHECK_(condition)` +* Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. ### Threading: -* GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided. -* GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are - already provided. Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and - GTEST_DEFINE_STATIC_MUTEX_(mutex) -* GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) -* GTEST_LOCK_EXCLUDED_(locks) +* `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. +* `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if Mutex and ThreadLocal are + already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` and + `GTEST_DEFINE_STATIC_MUTEX_(mutex)` +* `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` +* `GTEST_LOCK_EXCLUDED_(locks)` ### Underlying library support features -* GTEST_HAS_CXXABI_H_ +* `GTEST_HAS_CXXABI_H_` ### Exporting API symbols: -* GTEST_API_ - Specifier for exported symbols. +* `GTEST_API_` - Specifier for exported symbols. ## Header gtest-printers.h From c203bee2457e9d098fcca3b136dc8316c4f63bdb Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 13 Aug 2018 22:45:53 -0400 Subject: [PATCH 22/23] formatting custom/README.md --- .../include/gmock/internal/custom/README.md | 2 +- .../include/gtest/internal/custom/README.md | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/googlemock/include/gmock/internal/custom/README.md b/googlemock/include/gmock/internal/custom/README.md index 76969a7e..f6c93f61 100644 --- a/googlemock/include/gmock/internal/custom/README.md +++ b/googlemock/include/gmock/internal/custom/README.md @@ -2,7 +2,7 @@ The custom directory is an injection point for custom user configurations. -## Header gmock-port.h +## Header `gmock-port.h` The following macros can be defined: diff --git a/googletest/include/gtest/internal/custom/README.md b/googletest/include/gtest/internal/custom/README.md index 3a2b8855..ff391fb4 100644 --- a/googletest/include/gtest/internal/custom/README.md +++ b/googletest/include/gtest/internal/custom/README.md @@ -2,16 +2,16 @@ The custom directory is an injection point for custom user configurations. -## Header gtest.h +## Header `gtest.h` ### The following macros can be defined: * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of - OsStackTraceGetterInterface. -* `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for testing::TempDir(). See - testing::TempDir for semantics and signature. + `OsStackTraceGetterInterface`. +* `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See + `testing::TempDir` for semantics and signature. -## Header gtest-port.h +## Header `gtest-port.h` The following macros can be defined: @@ -36,9 +36,9 @@ The following macros can be defined: ### Threading: * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. -* `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if Mutex and ThreadLocal are - already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` and - `GTEST_DEFINE_STATIC_MUTEX_(mutex)` +* `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` + are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` + and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` * `GTEST_LOCK_EXCLUDED_(locks)` @@ -50,7 +50,7 @@ The following macros can be defined: * `GTEST_API_` - Specifier for exported symbols. -## Header gtest-printers.h +## Header `gtest-printers.h` -* See documentation at gtest/gtest-printers.h for details on how to define a +* See documentation at `gtest/gtest-printers.h` for details on how to define a custom printer. From f225735222b522abcb8286a654e71090403b75a1 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Tue, 14 Aug 2018 11:08:35 -0400 Subject: [PATCH 23/23] Code formatting changes, clean up, no functionality changes --- .../include/gmock/gmock-generated-actions.h | 15 +++++---------- .../include/gmock/gmock-generated-actions.h.pump | 3 +-- googletest/src/gtest-death-test.cc | 1 - googletest/test/googletest-printers-test.cc | 2 -- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h index 4ce7d350..cd3a102c 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h +++ b/googlemock/include/gmock/gmock-generated-actions.h @@ -215,8 +215,7 @@ class InvokeHelper > { get<2>(args), get<3>(args), get<4>(args), get<5>(args)); } - // There is no InvokeCallback() for 6-tuples, as google3 callbacks - // support 5 arguments at most. + // There is no InvokeCallback() for 6-tuples }; template > { get<6>(args)); } - // There is no InvokeCallback() for 7-tuples, as google3 callbacks - // support 5 arguments at most. + // There is no InvokeCallback() for 7-tuples }; template > { get<6>(args), get<7>(args)); } - // There is no InvokeCallback() for 8-tuples, as google3 callbacks - // support 5 arguments at most. + // There is no InvokeCallback() for 8-tuples }; template > { get<6>(args), get<7>(args), get<8>(args)); } - // There is no InvokeCallback() for 9-tuples, as google3 callbacks - // support 5 arguments at most. + // There is no InvokeCallback() for 9-tuples }; template (args), get<7>(args), get<8>(args), get<9>(args)); } - // There is no InvokeCallback() for 10-tuples, as google3 callbacks - // support 5 arguments at most. + // There is no InvokeCallback() for 10-tuples }; // Implements the Invoke(callback) action. diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump index 4ec66791..9db68d9b 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h.pump +++ b/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -88,8 +88,7 @@ $if i <= max_callback_arity [[ return callback->Run($gets); } ]] $else [[ - // There is no InvokeCallback() for $i-tuples, as google3 callbacks - // support $max_callback_arity arguments at most. + // There is no InvokeCallback() for $i-tuples ]] }; diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc index 854bc467..4da66c02 100644 --- a/googletest/src/gtest-death-test.cc +++ b/googletest/src/gtest-death-test.cc @@ -582,7 +582,6 @@ bool DeathTestImpl::Passed(bool status_ok) { if (status_ok) { # if GTEST_USES_PCRE // PCRE regexes support embedded NULs. - // GTEST_USES_PCRE is defined only in google3 mode const bool matched = RE::PartialMatch(error_message, *regex()); # else const bool matched = RE::PartialMatch(error_message.c_str(), *regex()); diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc index 40188630..e4bb0c25 100644 --- a/googletest/test/googletest-printers-test.cc +++ b/googletest/test/googletest-printers-test.cc @@ -919,8 +919,6 @@ TEST(PrintStlContainerTest, MultiSet) { } #if GTEST_HAS_STD_FORWARD_LIST_ -// is available on Linux in the google3 mode, but not on -// Windows or Mac OS X. TEST(PrintStlContainerTest, SinglyLinkedList) { int a[] = { 9, 2, 8 };