From 3d1dcac4c4662498c3f50fdb35071cce96231850 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Wed, 22 Jun 2022 14:15:53 +0300
Subject: [PATCH 01/56] change link from master to main in documentation
since master branch was changed to main, the links should be changed accordingly.
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 30edaecf..788b857a 100644
--- a/README.md
+++ b/README.md
@@ -135,7 +135,7 @@ that generates stub code for GoogleTest.
## Contributing Changes
Please read
-[`CONTRIBUTING.md`](https://github.com/google/googletest/blob/master/CONTRIBUTING.md)
+[`CONTRIBUTING.md`](https://github.com/google/googletest/blob/main/CONTRIBUTING.md)
for details on how to contribute to this project.
Happy testing!
From b3f3819a62d2aad678791d64cee0fefb2e921620 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Wed, 22 Jun 2022 14:21:07 +0300
Subject: [PATCH 02/56] Update gmock_output_test_golden.txt
---
googlemock/test/gmock_output_test_golden.txt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/googlemock/test/gmock_output_test_golden.txt b/googlemock/test/gmock_output_test_golden.txt
index fdf224fd..467fa20e 100644
--- a/googlemock/test/gmock_output_test_golden.txt
+++ b/googlemock/test/gmock_output_test_golden.txt
@@ -75,14 +75,14 @@ GMOCK WARNING:
Uninteresting mock function call - returning default value.
Function call: Bar2(0, 1)
Returns: false
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
[ OK ] GMockOutputTest.UninterestingCall
[ RUN ] GMockOutputTest.UninterestingCallToVoidFunction
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: Bar3(0, 1)
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
[ OK ] GMockOutputTest.UninterestingCallToVoidFunction
[ RUN ] GMockOutputTest.RetiredExpectation
unknown file: Failure
@@ -266,14 +266,14 @@ Uninteresting mock function call - taking default action specified at:
FILE:#:
Function call: Bar2(2, 2)
Returns: true
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
GMOCK WARNING:
Uninteresting mock function call - taking default action specified at:
FILE:#:
Function call: Bar2(1, 1)
Returns: false
-NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md#knowing-when-to-expect for details.
+NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#knowing-when-to-expect for details.
[ OK ] GMockOutputTest.UninterestingCallWithDefaultAction
[ RUN ] GMockOutputTest.ExplicitActionsRunOutWithDefaultAction
From 358a3f6e3ebba782b0e04011ffb4f4202355fae9 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Wed, 22 Jun 2022 14:31:03 +0300
Subject: [PATCH 03/56] documentation, change mater branch to main
---
docs/samples.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/samples.md b/docs/samples.md
index 2d97ca55..c11177bb 100644
--- a/docs/samples.md
+++ b/docs/samples.md
@@ -1,7 +1,7 @@
# Googletest Samples
If you're like us, you'd like to look at
-[googletest samples.](https://github.com/google/googletest/tree/master/googletest/samples)
+[googletest samples.](https://github.com/google/googletest/tree/main/googletest/samples)
The sample directory has a number of well-commented samples showing how to use a
variety of googletest features.
From 1b772a9bc4aad97764840000c52309de42d7ae48 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Wed, 22 Jun 2022 14:36:10 +0300
Subject: [PATCH 04/56] documentation, change mater branch to main
---
docs/_layouts/default.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html
index dcb42d91..c7f331b8 100644
--- a/docs/_layouts/default.html
+++ b/docs/_layouts/default.html
@@ -48,7 +48,7 @@
From f2f099fb7034370927ff8b62ce7892c485a8565a Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Wed, 22 Jun 2022 16:09:54 +0300
Subject: [PATCH 05/56] Update CONTRIBUTING.md
---
CONTRIBUTING.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b3f50436..3aba7f6c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -80,7 +80,7 @@ fairly rigid coding style, as defined by the
[google-styleguide](https://github.com/google/styleguide) project. All patches
will be expected to conform to the style outlined
[here](https://google.github.io/styleguide/cppguide.html). Use
-[.clang-format](https://github.com/google/googletest/blob/master/.clang-format)
+[.clang-format](https://github.com/google/googletest/blob/main/.clang-format)
to check your formatting.
## Requirements for Contributors
From b59ae848d16b3f3f5f20e38f91c70d748fe733f2 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Wed, 22 Jun 2022 16:12:54 +0300
Subject: [PATCH 06/56] Update faq.md
---
docs/faq.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/faq.md b/docs/faq.md
index c849aff9..19280972 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -267,7 +267,7 @@ If necessary, you can continue to derive test fixtures from a derived fixture.
GoogleTest has no limit on how deep the hierarchy can be.
For a complete example using derived test fixtures, see
-[sample5_unittest.cc](https://github.com/google/googletest/blob/master/googletest/samples/sample5_unittest.cc).
+[sample5_unittest.cc](https://github.com/google/googletest/blob/main/googletest/samples/sample5_unittest.cc).
## My compiler complains "void value not ignored as it ought to be." What does this mean?
From fde6af67908ce431d7c08fa81781978b988fdb73 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Wed, 22 Jun 2022 16:21:35 +0300
Subject: [PATCH 07/56] documentation, change mater branch to main
---
googletest/README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/googletest/README.md b/googletest/README.md
index d26b309e..60aaede4 100644
--- a/googletest/README.md
+++ b/googletest/README.md
@@ -9,7 +9,7 @@ depends on which build system you use, and is usually straightforward.
### Build with CMake
GoogleTest comes with a CMake build script
-([CMakeLists.txt](https://github.com/google/googletest/blob/master/CMakeLists.txt))
+([CMakeLists.txt](https://github.com/google/googletest/blob/main/CMakeLists.txt))
that can be used on a wide range of platforms ("C" stands for cross-platform.).
If you don't have CMake installed already, you can download it for free from
.
@@ -140,7 +140,7 @@ command line. Generally, these macros are named like `GTEST_XYZ` and you define
them to either 1 or 0 to enable or disable a certain feature.
We list the most frequently used macros below. For a complete list, see file
-[include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-port.h).
+[include/gtest/internal/gtest-port.h](https://github.com/google/googletest/blob/main/googletest/include/gtest/internal/gtest-port.h).
### Multi-threaded Tests
From 72901486ba39f8f4df9d0386b0521b711ef374a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Travert?=
Date: Sun, 26 Jun 2022 18:59:46 +0200
Subject: [PATCH 08/56] Avoid implicit conversion from int to char
---
googlemock/src/gmock-internal-utils.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc
index 0a74841f..2d7c5c4e 100644
--- a/googlemock/src/gmock-internal-utils.cc
+++ b/googlemock/src/gmock-internal-utils.cc
@@ -201,7 +201,7 @@ GTEST_API_ void IllegalDoDefault(const char* file, int line) {
constexpr char UnBase64Impl(char c, const char* const base64, char carry) {
return *base64 == 0 ? static_cast(65)
: *base64 == c ? carry
- : UnBase64Impl(c, base64 + 1, carry + 1);
+ : UnBase64Impl(c, base64 + 1, static_cast(carry + 1));
}
template
From 5eaa1139038076ed9bc029ab6518844a1b03ea7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Travert?=
Date: Sun, 26 Jun 2022 19:01:00 +0200
Subject: [PATCH 09/56] Avoid implicit conversion from int to char
---
googletest/src/gtest-printers.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googletest/src/gtest-printers.cc b/googletest/src/gtest-printers.cc
index f3976d23..d475ad36 100644
--- a/googletest/src/gtest-printers.cc
+++ b/googletest/src/gtest-printers.cc
@@ -315,7 +315,7 @@ void PrintTo(__uint128_t v, ::std::ostream* os) {
low = low / 10 + high_mod * 1844674407370955161 + carry / 10;
char digit = static_cast(carry % 10);
- *--p = '0' + digit;
+ *--p = static_cast('0' + digit);
}
*os << p;
}
From df4b8edee0928a080852237c9a3443aaa68af7b9 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Mon, 27 Jun 2022 09:48:05 +0300
Subject: [PATCH 10/56] Update advanced.md
master branch changed to main branch in links
---
docs/advanced.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/advanced.md b/docs/advanced.md
index 9a752b92..bce983c6 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -1142,8 +1142,8 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(FooTest);
You can see [sample7_unittest.cc] and [sample8_unittest.cc] for more examples.
-[sample7_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample7_unittest.cc "Parameterized Test example"
-[sample8_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample8_unittest.cc "Parameterized Test example with multiple parameters"
+[sample7_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample7_unittest.cc "Parameterized Test example"
+[sample8_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample8_unittest.cc "Parameterized Test example with multiple parameters"
### Creating Value-Parameterized Abstract Tests
@@ -1294,7 +1294,7 @@ TYPED_TEST(FooTest, HasPropertyA) { ... }
You can see [sample6_unittest.cc] for a complete example.
-[sample6_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample6_unittest.cc "Typed Test example"
+[sample6_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample6_unittest.cc "Typed Test example"
## Type-Parameterized Tests
@@ -1733,7 +1733,7 @@ You can do so by adding one line:
Now, sit back and enjoy a completely different output from your tests. For more
details, see [sample9_unittest.cc].
-[sample9_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample9_unittest.cc "Event listener example"
+[sample9_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample9_unittest.cc "Event listener example"
You may append more than one listener to the list. When an `On*Start()` or
`OnTestPartResult()` event is fired, the listeners will receive it in the order
@@ -1760,7 +1760,7 @@ by the former.
See [sample10_unittest.cc] for an example of a failure-raising listener.
-[sample10_unittest.cc]: https://github.com/google/googletest/blob/master/googletest/samples/sample10_unittest.cc "Failure-raising listener example"
+[sample10_unittest.cc]: https://github.com/google/googletest/blob/main/googletest/samples/sample10_unittest.cc "Failure-raising listener example"
## Running Test Programs: Advanced Options
From dfa990f9426797abfc10e2ec02ff9ccdbe8b4619 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Mon, 27 Jun 2022 09:50:36 +0300
Subject: [PATCH 11/56] Update gmock-spec-builders.cc
---
googlemock/src/gmock-spec-builders.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc
index 658ad3fa..78fbdfaa 100644
--- a/googlemock/src/gmock-spec-builders.cc
+++ b/googlemock/src/gmock-spec-builders.cc
@@ -295,7 +295,7 @@ void ReportUninterestingCall(CallReaction reaction, const std::string& msg) {
"call should not happen. Do not suppress it by blindly adding "
"an EXPECT_CALL() if you don't mean to enforce the call. "
"See "
- "https://github.com/google/googletest/blob/master/docs/"
+ "https://github.com/google/googletest/blob/main/docs/"
"gmock_cook_book.md#"
"knowing-when-to-expect for details.\n",
stack_frames_to_skip);
From 64df55449acb3b0c2e9de2ded58def728f8e3114 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Mon, 27 Jun 2022 09:51:44 +0300
Subject: [PATCH 12/56] Update gtest-death-test.cc
---
googletest/src/gtest-death-test.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index e6abc627..5c9d3f23 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -249,7 +249,7 @@ static std::string DeathTestThreadWarning(size_t thread_count) {
msg << "detected " << thread_count << " threads.";
}
msg << " See "
- "https://github.com/google/googletest/blob/master/docs/"
+ "https://github.com/google/googletest/blob/main/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.";
From 66d2463610e5db956e742e4267312169b0a84958 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Mon, 27 Jun 2022 09:53:40 +0300
Subject: [PATCH 13/56] Update gmock-spec-builders_test.cc
master branch changed to main in link
---
googlemock/test/gmock-spec-builders_test.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc
index 122d5b94..bb1e83ef 100644
--- a/googlemock/test/gmock-spec-builders_test.cc
+++ b/googlemock/test/gmock-spec-builders_test.cc
@@ -2059,7 +2059,7 @@ class GMockVerboseFlagTest : public VerboseFlagPreservingFixture {
"call should not happen. Do not suppress it by blindly adding "
"an EXPECT_CALL() if you don't mean to enforce the call. "
"See "
- "https://github.com/google/googletest/blob/master/docs/"
+ "https://github.com/google/googletest/blob/main/docs/"
"gmock_cook_book.md#"
"knowing-when-to-expect for details.";
From 1547c2acc833f53263b23fdea7fe1eeddd792933 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Mon, 27 Jun 2022 09:55:28 +0300
Subject: [PATCH 14/56] Update gmock-actions.h
master branch changed to main in links
---
googlemock/include/gmock/gmock-actions.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index c785ad8a..7e78c09a 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -122,7 +122,7 @@
// MORE INFORMATION:
//
// To learn more about using these macros, please search for 'ACTION' on
-// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md
+// https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md
// IWYU pragma: private, include "gmock/gmock.h"
// IWYU pragma: friend gmock/.*
From d0af91ead3983b0eacae3efa5bf3a2b368141bb0 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Mon, 27 Jun 2022 09:56:59 +0300
Subject: [PATCH 15/56] Update gmock-matchers.h
branch master changed to main on link
---
googlemock/include/gmock/gmock-matchers.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 62829011..186a95ca 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -240,7 +240,7 @@
//
// To learn more about using these macros, please search for 'MATCHER'
// on
-// https://github.com/google/googletest/blob/master/docs/gmock_cook_book.md
+// https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md
//
// This file also implements some commonly used argument matchers. More
// matchers can be defined by the user implementing the
From dd72ed19fe52f2dbca3b354d9a49eb4124693b99 Mon Sep 17 00:00:00 2001
From: assafpr <93249401+assafpr@users.noreply.github.com>
Date: Mon, 27 Jun 2022 09:59:06 +0300
Subject: [PATCH 16/56] Update gtest.cc
fix a broken link
---
googletest/src/gtest.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 6f31dd22..1b9c51be 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -6037,7 +6037,7 @@ bool ShouldRunTestOnShard(int total_shards, int shard_index, int test_id) {
// each TestSuite and TestInfo object.
// If shard_tests == true, further filters tests based on sharding
// variables in the environment - see
-// https://github.com/google/googletest/blob/master/googletest/docs/advanced.md
+// https://github.com/google/googletest/blob/main/docs/advanced.md
// . Returns the number of tests that should run.
int UnitTestImpl::FilterTests(ReactionToSharding shard_tests) {
const int32_t total_shards = shard_tests == HONOR_SHARDING_PROTOCOL
From 2cf9987ce3510de36640dcabd3d53db2c09312f6 Mon Sep 17 00:00:00 2001
From: yutotnh <57719497+yutotnh@users.noreply.github.com>
Date: Fri, 1 Jul 2022 18:32:49 +0900
Subject: [PATCH 17/56] fix: some typos in comment
---
googlemock/test/gmock-actions_test.cc | 4 ++--
googlemock/test/gmock-matchers-misc_test.cc | 2 +-
googletest/include/gtest/internal/gtest-internal.h | 2 +-
googletest/src/gtest-internal-inl.h | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index 215495ed..e5a7ae13 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -466,7 +466,7 @@ TEST(DefaultValueOfReferenceTest, IsInitiallyUnset) {
EXPECT_FALSE(DefaultValue::IsSet());
}
-// Tests that DefaultValue::Exists is false initiallly.
+// Tests that DefaultValue::Exists is false initially.
TEST(DefaultValueOfReferenceTest, IsInitiallyNotExisting) {
EXPECT_FALSE(DefaultValue::Exists());
EXPECT_FALSE(DefaultValue::Exists());
@@ -807,7 +807,7 @@ TEST(ReturnTest, MoveOnlyResultType) {
"");
}
-// Tests that Return(v) is covaraint.
+// Tests that Return(v) is covariant.
struct Base {
bool operator==(const Base&) { return true; }
diff --git a/googlemock/test/gmock-matchers-misc_test.cc b/googlemock/test/gmock-matchers-misc_test.cc
index c68431c1..53f4962b 100644
--- a/googlemock/test/gmock-matchers-misc_test.cc
+++ b/googlemock/test/gmock-matchers-misc_test.cc
@@ -1561,7 +1561,7 @@ TEST(AnyOfArrayTest, Matchers) {
}
TEST_P(AnyOfArrayTestP, ExplainsMatchResultCorrectly) {
- // AnyOfArray and AllOfArry use the same underlying template-template,
+ // AnyOfArray and AllOfArray use the same underlying template-template,
// thus it is sufficient to test one here.
const std::vector v0{};
const std::vector v1{1};
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index 9b04e4c8..4d919458 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -461,7 +461,7 @@ class TestFactoryBase {
TestFactoryBase& operator=(const TestFactoryBase&) = delete;
};
-// This class provides implementation of TeastFactoryBase interface.
+// This class provides implementation of TestFactoryBase interface.
// It is used in TEST and TEST_F macros.
template
class TestFactoryImpl : public TestFactoryBase {
diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h
index 0b9e929c..ffe5322f 100644
--- a/googletest/src/gtest-internal-inl.h
+++ b/googletest/src/gtest-internal-inl.h
@@ -507,9 +507,9 @@ class GTEST_API_ UnitTestImpl {
virtual ~UnitTestImpl();
// There are two different ways to register your own TestPartResultReporter.
- // You can register your own repoter to listen either only for test results
+ // You can register your own reporter to listen either only for test results
// from the current thread or for results from all threads.
- // By default, each per-thread test result repoter just passes a new
+ // By default, each per-thread test result reporter just passes a new
// TestPartResult to the global test result reporter, which registers the
// test part result for the currently running test.
From 6c57d607c7d75df2d87b1e349f9bef054499c1bf Mon Sep 17 00:00:00 2001
From: yutotnh <57719497+yutotnh@users.noreply.github.com>
Date: Fri, 1 Jul 2022 18:33:00 +0900
Subject: [PATCH 18/56] fix: typo in test name
---
googlemock/test/gmock-spec-builders_test.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc
index 122d5b94..bb0773b5 100644
--- a/googlemock/test/gmock-spec-builders_test.cc
+++ b/googlemock/test/gmock-spec-builders_test.cc
@@ -1064,7 +1064,7 @@ TEST(UnexpectedCallTest, UnmatchedArguments) {
// Tests that Google Mock explains that an expectation with
// unsatisfied pre-requisites doesn't match the call.
-TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
+TEST(UnexpectedCallTest, UnsatisfiedPrerequisites) {
Sequence s1, s2;
MockB b;
EXPECT_CALL(b, DoB(1)).InSequence(s1);
From 644a4bea02c478f73325b9125a2b6409f3c55420 Mon Sep 17 00:00:00 2001
From: yutotnh <57719497+yutotnh@users.noreply.github.com>
Date: Fri, 1 Jul 2022 18:33:14 +0900
Subject: [PATCH 19/56] fix: some typos in source
---
googletest/src/gtest-internal-inl.h | 2 +-
googletest/src/gtest.cc | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h
index ffe5322f..8c650e0c 100644
--- a/googletest/src/gtest-internal-inl.h
+++ b/googletest/src/gtest-internal-inl.h
@@ -850,7 +850,7 @@ class GTEST_API_ UnitTestImpl {
default_per_thread_test_part_result_reporter_;
// Points to (but doesn't own) the global test part result reporter.
- TestPartResultReporterInterface* global_test_part_result_repoter_;
+ TestPartResultReporterInterface* global_test_part_result_reporter_;
// Protects read and write access to global_test_part_result_reporter_.
internal::Mutex global_test_part_result_reporter_mutex_;
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 6f31dd22..6beac089 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -1008,14 +1008,14 @@ void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
TestPartResultReporterInterface*
UnitTestImpl::GetGlobalTestPartResultReporter() {
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- return global_test_part_result_repoter_;
+ return global_test_part_result_reporter_;
}
// Sets the global test part result reporter.
void UnitTestImpl::SetGlobalTestPartResultReporter(
TestPartResultReporterInterface* reporter) {
internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
- global_test_part_result_repoter_ = reporter;
+ global_test_part_result_reporter_ = reporter;
}
// Returns the test part result reporter for the current thread.
@@ -5516,7 +5516,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4355 /* using this in initializer */)
default_global_test_part_result_reporter_(this),
default_per_thread_test_part_result_reporter_(this),
- GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_repoter_(
+ GTEST_DISABLE_MSC_WARNINGS_POP_() global_test_part_result_reporter_(
&default_global_test_part_result_reporter_),
per_thread_test_part_result_reporter_(
&default_per_thread_test_part_result_reporter_),
From 96ddde12359c8f20b6c27a99a6814c40b51f4452 Mon Sep 17 00:00:00 2001
From: Andrei Polushin
Date: Mon, 11 Jul 2022 17:35:43 +0700
Subject: [PATCH 20/56] cmake: find python in order specified by PATH
environment variable.
CMake policy CMP0094 controls a lookup strategy used to find a Python
executable:
* CMP0094=OLD selects a Python executable with a higher version.
* CMP0094=NEW selects a Python executable found earlier in PATH.
NEW behavior is critical in presence of a Python virtual environment
established and activated, i.e. added to the PATH variable.
In case GoogleTest is embedded into a larger project, the result of
`find_package(Python)` affects the whole build, not only GoogleTest
component itself.
---
googletest/cmake/internal_utils.cmake | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index 107147f6..42850f59 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -244,6 +244,12 @@ function(cxx_executable name dir libs)
${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN})
endfunction()
+# CMP0094 policy enables finding a Python executable in the LOCATION order, as
+# specified by the PATH environment variable.
+if (POLICY CMP0094)
+ cmake_policy(SET CMP0094 NEW)
+endif()
+
# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0")
find_package(PythonInterp)
From a2d6ee847e8f7181c6373901f55ae0abd69ec0ae Mon Sep 17 00:00:00 2001
From: Andrei Polushin
Date: Mon, 11 Jul 2022 17:16:58 +0700
Subject: [PATCH 21/56] cmake: make PDB output directory match that of a static
library.
PDB files should be created at the same location as their primary
artifact, which is either static library or a DLL.
On Windows, an artifact location is controlled by:
* RUNTIME_OUTPUT_DIRECTORY is a directory of a DLL artifact.
* ARCHIVE_OUTPUT_DIRECTORY is a directory of a LIB artifact.
A PDB file location is controlled:
* PDB_OUTPUT_DIRECTORY should match a directory of a DLL artifact.
* COMPILE_PDB_OUTPUT_DIRECTORY should match a directory of a LIB artifact.
---
googletest/cmake/internal_utils.cmake | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index 107147f6..b259ced4 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -162,7 +162,8 @@ function(cxx_library_with_type name type cxx_flags)
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
- PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
+ PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+ COMPILE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
# make PDBs match library name
get_target_property(pdb_debug_postfix ${name} DEBUG_POSTFIX)
set_target_properties(${name}
From 3655149a60ad7bfeb0902f7308b95dafa97a68ad Mon Sep 17 00:00:00 2001
From: Andrei Polushin
Date: Thu, 14 Jul 2022 21:36:41 +0700
Subject: [PATCH 22/56] export ThreadLocalValueHolderBase which is required by
exported APIs.
fixes #3944
---
googletest/include/gtest/internal/gtest-port.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 0003d276..c9e1f324 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -1710,7 +1710,7 @@ typedef GTestMutexLock MutexLock;
// C-linkage. Therefore it cannot be templatized to access
// ThreadLocal. Hence the need for class
// ThreadLocalValueHolderBase.
-class ThreadLocalValueHolderBase {
+class GTEST_API_ ThreadLocalValueHolderBase {
public:
virtual ~ThreadLocalValueHolderBase() {}
};
From 2d1cd6ee277ea3de5803115568341da48e90676a Mon Sep 17 00:00:00 2001
From: Robert Adam
Date: Tue, 28 Jun 2022 10:47:00 +0200
Subject: [PATCH 23/56] Set cmake policy CMP0069
This ensures that LTO works as expected whenever the main project
has it enabled.
---
CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4daf35b5..3cf5c270 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,10 @@ if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
+if (POLICY CMP0069)
+ cmake_policy(SET CMP0069 NEW)
+endif (POLICY CMP0069)
+
project(googletest-distribution)
set(GOOGLETEST_VERSION 1.11.0)
From 61720589cbef9707b3c5247d02141a7c31e2876f Mon Sep 17 00:00:00 2001
From: Matei Dibu
Date: Wed, 20 Jul 2022 19:16:51 +0300
Subject: [PATCH 24/56] gtest-death-test: add 'noreturn'
---
googletest/src/gtest-death-test.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index e6abc627..d549e83d 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -284,7 +284,7 @@ enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
// message is propagated back to the parent process. Otherwise, the
// message is simply printed to stderr. In either case, the program
// then exits with status 1.
-static void DeathTestAbort(const std::string& message) {
+[[noreturn]] static void DeathTestAbort(const std::string& message) {
// On a POSIX system, this function may be called from a threadsafe-style
// death test child process, which operates on a very small stack. Use
// the heap for any additional non-minuscule memory requirements.
From aa2e91fd6918519dafa3bee4aa706d04857e7d06 Mon Sep 17 00:00:00 2001
From: Yuriy Chernyshov
Date: Thu, 21 Jul 2022 14:25:43 +0300
Subject: [PATCH 25/56] Continuation for #3183
Some of the #ifdefs were missed in original PR.
Should be fixed now.
---
googletest/include/gtest/gtest-printers.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h
index a91e8b8b..8e4d2953 100644
--- a/googletest/include/gtest/gtest-printers.h
+++ b/googletest/include/gtest/gtest-printers.h
@@ -384,7 +384,7 @@ GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char32_t);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char8_t, ::std::u8string);
GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char8_t, ::std::u8string);
#endif
@@ -556,7 +556,7 @@ inline void PrintTo(const ::std::string& s, ::std::ostream* os) {
}
// Overloads for ::std::u8string
-#ifdef __cpp_char8_t
+#ifdef __cpp_lib_char8_t
GTEST_API_ void PrintU8StringTo(const ::std::u8string& s, ::std::ostream* os);
inline void PrintTo(const ::std::u8string& s, ::std::ostream* os) {
PrintU8StringTo(s, os);
From b1e9b6323a17002b8359fef338c57bc0437caf57 Mon Sep 17 00:00:00 2001
From: Dino Radakovic
Date: Mon, 25 Jul 2022 14:37:44 -0700
Subject: [PATCH 26/56] Add IsEmpty overload for C-style strings
Fixes #3937
PiperOrigin-RevId: 463180144
Change-Id: I21b528acc4c3f3aba4234642be01fcead7fe7f00
---
.../include/gmock/gmock-more-matchers.h | 45 ++++++++++++++++---
.../test/gmock-matchers-comparisons_test.cc | 26 +++++++++++
2 files changed, 64 insertions(+), 7 deletions(-)
diff --git a/googlemock/include/gmock/gmock-more-matchers.h b/googlemock/include/gmock/gmock-more-matchers.h
index 47aaf984..d9a92107 100644
--- a/googlemock/include/gmock/gmock-more-matchers.h
+++ b/googlemock/include/gmock/gmock-more-matchers.h
@@ -40,6 +40,9 @@
#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_
#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_
+#include
+#include
+
#include "gmock/gmock-matchers.h"
namespace testing {
@@ -56,14 +59,42 @@ namespace testing {
#endif
#endif
-// Defines a matcher that matches an empty container. The container must
-// support both size() and empty(), which all STL-like containers provide.
-MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
- if (arg.empty()) {
- return true;
+namespace internal {
+
+// Implements the polymorphic IsEmpty matcher, which
+// can be used as a Matcher as long as T is either a container that defines
+// empty() and size() (e.g. std::vector or std::string), or a C-style string.
+class IsEmptyMatcher {
+ public:
+ // Matches anything that defines empty() and size().
+ template
+ bool MatchAndExplain(const MatcheeContainerType& c,
+ MatchResultListener* listener) const {
+ if (c.empty()) {
+ return true;
+ }
+ *listener << "whose size is " << c.size();
+ return false;
}
- *result_listener << "whose size is " << arg.size();
- return false;
+
+ // Matches C-style strings.
+ bool MatchAndExplain(const char* s, MatchResultListener* listener) const {
+ return MatchAndExplain(std::string(s), listener);
+ }
+
+ // Describes what this matcher matches.
+ void DescribeTo(std::ostream* os) const { *os << "is empty"; }
+
+ void DescribeNegationTo(std::ostream* os) const { *os << "isn't empty"; }
+};
+
+} // namespace internal
+
+// Creates a polymorphic matcher that matches an empty container or C-style
+// string. The container must support both size() and empty(), which all
+// STL-like containers provide.
+inline PolymorphicMatcher IsEmpty() {
+ return MakePolymorphicMatcher(internal::IsEmptyMatcher());
}
// Define a matcher that matches a value that evaluates in boolean
diff --git a/googlemock/test/gmock-matchers-comparisons_test.cc b/googlemock/test/gmock-matchers-comparisons_test.cc
index eb8f3f63..c90b0b4e 100644
--- a/googlemock/test/gmock-matchers-comparisons_test.cc
+++ b/googlemock/test/gmock-matchers-comparisons_test.cc
@@ -39,6 +39,8 @@
#pragma warning(disable : 4100)
#endif
+#include
+
#include "test/gmock-matchers_test.h"
namespace testing {
@@ -983,6 +985,30 @@ TEST(ComparisonBaseTest, WorksWithMoveOnly) {
helper.Call(MoveOnly(1));
}
+TEST(IsEmptyTest, MatchesContainer) {
+ const Matcher> m = IsEmpty();
+ std::vector a = {};
+ std::vector b = {1};
+ EXPECT_TRUE(m.Matches(a));
+ EXPECT_FALSE(m.Matches(b));
+}
+
+TEST(IsEmptyTest, MatchesStdString) {
+ const Matcher m = IsEmpty();
+ std::string a = "z";
+ std::string b = "";
+ EXPECT_FALSE(m.Matches(a));
+ EXPECT_TRUE(m.Matches(b));
+}
+
+TEST(IsEmptyTest, MatchesCString) {
+ const Matcher m = IsEmpty();
+ const char a[] = "";
+ const char b[] = "x";
+ EXPECT_TRUE(m.Matches(a));
+ EXPECT_FALSE(m.Matches(b));
+}
+
// Tests that IsNull() matches any NULL pointer of any type.
TEST(IsNullTest, MatchesNullPointer) {
Matcher m1 = IsNull();
From dd7a9d29a33de34836c345c3b753d4eba15c5f44 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Thu, 28 Jul 2022 17:14:35 -0700
Subject: [PATCH 27/56] Add support of 18-member structs to gmock
UnpackStructImpl.
PiperOrigin-RevId: 463961734
Change-Id: Ib62e320a745c190955f181c1f4f12e4cd407ef22
---
googlemock/include/gmock/gmock-matchers.h | 9 +++++++--
googlemock/test/gmock-matchers-comparisons_test.cc | 10 ++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 3c8cc32e..f45ace18 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -3240,6 +3240,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<17>, char) {
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q] = t;
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q);
}
+template
+auto UnpackStructImpl(const T& t, MakeIndexSequence<18>, char) {
+ const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = t;
+ return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r);
+}
#endif // defined(__cpp_structured_bindings)
template
@@ -3306,8 +3311,8 @@ class FieldsAreMatcherImpl>
std::vector inner_listener(sizeof...(I));
VariadicExpand(
- {failed_pos == ~size_t{} && !std::get(matchers_).MatchAndExplain(
- std::get(tuple), &inner_listener[I])
+ {failed_pos == ~size_t{}&& !std::get(matchers_).MatchAndExplain(
+ std::get(tuple), &inner_listener[I])
? failed_pos = I
: 0 ...});
if (failed_pos != ~size_t{}) {
diff --git a/googlemock/test/gmock-matchers-comparisons_test.cc b/googlemock/test/gmock-matchers-comparisons_test.cc
index c90b0b4e..1c6cac62 100644
--- a/googlemock/test/gmock-matchers-comparisons_test.cc
+++ b/googlemock/test/gmock-matchers-comparisons_test.cc
@@ -1710,6 +1710,16 @@ TEST(FieldsAreTest, StructuredBindings) {
};
EXPECT_THAT(MyVarType16{},
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+ struct MyVarType17 {
+ int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
+ };
+ EXPECT_THAT(MyVarType17{},
+ FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+ struct MyVarType18 {
+ int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r;
+ };
+ EXPECT_THAT(MyVarType18{},
+ FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}
#endif
From 3280a930bf3f2fdb77da9a6cdf5866ef22708ff1 Mon Sep 17 00:00:00 2001
From: Baruch Burstein
Date: Sun, 31 Jul 2022 22:50:04 +0300
Subject: [PATCH 28/56] Custom type with Combine(). Fix for #3781
---
docs/reference/testing.md | 1 +
googletest/include/gtest/gtest-param-test.h | 40 ++++++++++
googletest/include/gtest/gtest.h | 2 +-
.../include/gtest/internal/gtest-param-util.h | 71 +++++++++++++++++
googletest/test/googletest-param-test-test.cc | 76 ++++++++++++++++---
5 files changed, 180 insertions(+), 10 deletions(-)
diff --git a/docs/reference/testing.md b/docs/reference/testing.md
index dc479423..877dfa32 100644
--- a/docs/reference/testing.md
+++ b/docs/reference/testing.md
@@ -109,6 +109,7 @@ namespace:
| `ValuesIn(container)` or `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 as `std::tuple` *n*-tuples all combinations (Cartesian product) of the values generated by the given *n* generators `g1`, `g2`, ..., `gN`. |
+| `ConvertGenerator(g)` | Yields values generated by generator `g`, `static_cast` to `T`. |
The optional last argument *`name_generator`* is a function or functor that
generates custom test name suffixes based on the test parameters. The function
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h
index b55119ac..d59e552e 100644
--- a/googletest/include/gtest/gtest-param-test.h
+++ b/googletest/include/gtest/gtest-param-test.h
@@ -407,6 +407,46 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
return internal::CartesianProductHolder(g...);
}
+// ConvertGenerator() wraps a parameter generator in order to cast each prduced
+// value through a known type before supplying it to the test suite
+//
+// Synopsis:
+// ConvertGenerator(gen)
+// - returns a generator producing the same elements as generated by gen, but
+// each element is static_cast to type T before being returned
+//
+// It is useful when using the Combine() function to get the generated
+// parameters in a custom type instead of std::tuple
+//
+// Example:
+//
+// This will instantiate tests in test suite AnimalTest each one with
+// the parameter values tuple("cat", BLACK), tuple("cat", WHITE),
+// tuple("dog", BLACK), and tuple("dog", WHITE):
+//
+// enum Color { BLACK, GRAY, WHITE };
+// struct ParamType {
+// using TupleT = std::tuple;
+// std::string animal;
+// Color color;
+// ParamType(TupleT t) : animal(std::get<0>(t)), color(std::get<1>(t)) {}
+// };
+// class AnimalTest
+// : public testing::TestWithParam {...};
+//
+// TEST_P(AnimalTest, AnimalLooksNice) {...}
+//
+// INSTANTIATE_TEST_SUITE_P(AnimalVariations, AnimalTest,
+// ConvertGenerator(
+// Combine(Values("cat", "dog"),
+// Values(BLACK, WHITE))));
+//
+template
+internal::ParamConverterGenerator ConvertGenerator(
+ internal::ParamGenerator gen) {
+ return internal::ParamConverterGenerator(gen);
+}
+
#define TEST_P(test_suite_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
: public test_suite_name { \
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index d19a587a..0c97f6c9 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -1625,7 +1625,7 @@ class GTEST_API_ AssertHelper {
// the GetParam() method.
//
// Use it with one of the parameter generator defining functions, like Range(),
-// Values(), ValuesIn(), Bool(), and Combine().
+// Values(), ValuesIn(), Bool(), Combine(), and ConvertGenerator().
//
// class FooTest : public ::testing::TestWithParam {
// protected:
diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h
index e7af2f90..c643a3bd 100644
--- a/googletest/include/gtest/internal/gtest-param-util.h
+++ b/googletest/include/gtest/internal/gtest-param-util.h
@@ -950,6 +950,77 @@ class CartesianProductHolder {
std::tuple generators_;
};
+template
+class ParamGeneratorConverter : public ParamGeneratorInterface {
+ public:
+ ParamGeneratorConverter(ParamGenerator gen)
+ : generator_(std::move(gen)) {}
+
+ ParamIteratorInterface* Begin() const override {
+ return new Iterator(this, generator_.begin(), generator_.end());
+ }
+ ParamIteratorInterface* End() const override {
+ return new Iterator(this, generator_.end(), generator_.end());
+ }
+
+ private:
+ class Iterator : public ParamIteratorInterface {
+ public:
+ Iterator(const ParamGeneratorInterface* base, ParamIterator it,
+ ParamIterator end)
+ : base_(base), it_(it), end_(end) {
+ if (it_ != end_) value_ = std::make_shared(static_cast(*it_));
+ }
+ ~Iterator() override {}
+
+ const ParamGeneratorInterface* BaseGenerator() const override {
+ return base_;
+ }
+ void Advance() override {
+ ++it_;
+ if (it_ != end_) value_ = std::make_shared(static_cast(*it_));
+ }
+ ParamIteratorInterface* Clone() const override {
+ return new Iterator(*this);
+ }
+ const To* Current() const override { return value_.get(); }
+ bool Equals(const ParamIteratorInterface& other) const override {
+ // Having the same base generator guarantees that the other
+ // iterator is of the same type and we can downcast.
+ GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
+ << "The program attempted to compare iterators "
+ << "from different generators." << std::endl;
+ const ParamIterator other_it =
+ CheckedDowncastToActualType(&other)->it_;
+ return it_ == other_it;
+ }
+
+ private:
+ Iterator(const Iterator& other) = default;
+
+ const ParamGeneratorInterface* const base_;
+ ParamIterator it_;
+ ParamIterator end_;
+ std::shared_ptr value_;
+ }; // class ParamGeneratorConverter::Iterator
+
+ ParamGenerator generator_;
+}; // class ParamGeneratorConverter
+
+template
+class ParamConverterGenerator {
+ public:
+ ParamConverterGenerator(ParamGenerator g) : generator(g) {}
+
+ template
+ operator ParamGenerator() const {
+ return ParamGenerator(new ParamGeneratorConverter(generator));
+ }
+
+ private:
+ ParamGenerator generator;
+};
+
} // namespace internal
} // namespace testing
diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc
index e3090ae4..a1d27864 100644
--- a/googletest/test/googletest-param-test-test.cc
+++ b/googletest/test/googletest-param-test-test.cc
@@ -51,6 +51,7 @@ using ::std::vector;
using ::testing::AddGlobalTestEnvironment;
using ::testing::Bool;
using ::testing::Combine;
+using ::testing::ConvertGenerator;
using ::testing::Message;
using ::testing::Range;
using ::testing::TestWithParam;
@@ -402,7 +403,7 @@ TEST(BoolTest, BoolWorks) {
TEST(CombineTest, CombineWithTwoParameters) {
const char* foo = "foo";
const char* bar = "bar";
- const ParamGenerator > gen =
+ const ParamGenerator> gen =
Combine(Values(foo, bar), Values(3, 4));
std::tuple expected_values[] = {
@@ -413,7 +414,7 @@ TEST(CombineTest, CombineWithTwoParameters) {
// Tests that Combine() with three parameters generates the expected sequence.
TEST(CombineTest, CombineWithThreeParameters) {
- const ParamGenerator > gen =
+ const ParamGenerator> gen =
Combine(Values(0, 1), Values(3, 4), Values(5, 6));
std::tuple expected_values[] = {
std::make_tuple(0, 3, 5), std::make_tuple(0, 3, 6),
@@ -427,7 +428,7 @@ TEST(CombineTest, CombineWithThreeParameters) {
// sequence generates a sequence with the number of elements equal to the
// number of elements in the sequence generated by the second parameter.
TEST(CombineTest, CombineWithFirstParameterSingleValue) {
- const ParamGenerator > gen =
+ const ParamGenerator> gen =
Combine(Values(42), Values(0, 1));
std::tuple expected_values[] = {std::make_tuple(42, 0),
@@ -439,7 +440,7 @@ TEST(CombineTest, CombineWithFirstParameterSingleValue) {
// sequence generates a sequence with the number of elements equal to the
// number of elements in the sequence generated by the first parameter.
TEST(CombineTest, CombineWithSecondParameterSingleValue) {
- const ParamGenerator > gen =
+ const ParamGenerator> gen =
Combine(Values(0, 1), Values(42));
std::tuple expected_values[] = {std::make_tuple(0, 42),
@@ -450,7 +451,7 @@ TEST(CombineTest, CombineWithSecondParameterSingleValue) {
// Tests that when the first parameter produces an empty sequence,
// Combine() produces an empty sequence, too.
TEST(CombineTest, CombineWithFirstParameterEmptyRange) {
- const ParamGenerator > gen =
+ const ParamGenerator> gen =
Combine(Range(0, 0), Values(0, 1));
VerifyGeneratorIsEmpty(gen);
}
@@ -458,7 +459,7 @@ TEST(CombineTest, CombineWithFirstParameterEmptyRange) {
// Tests that when the second parameter produces an empty sequence,
// Combine() produces an empty sequence, too.
TEST(CombineTest, CombineWithSecondParameterEmptyRange) {
- const ParamGenerator > gen =
+ const ParamGenerator> gen =
Combine(Values(0, 1), Range(1, 1));
VerifyGeneratorIsEmpty(gen);
}
@@ -469,7 +470,7 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
const char* foo = "foo";
const char* bar = "bar";
const ParamGenerator<
- std::tuple >
+ std::tuple>
gen =
Combine(Values(foo, bar), Values(1), Values(2), Values(3), Values(4),
Values(5), Values(6), Values(7), Values(8), Values(9));
@@ -497,11 +498,11 @@ class NonDefaultConstructAssignString {
};
TEST(CombineTest, NonDefaultConstructAssign) {
- const ParamGenerator > gen =
+ const ParamGenerator> gen =
Combine(Values(0, 1), Values(NonDefaultConstructAssignString("A"),
NonDefaultConstructAssignString("B")));
- ParamGenerator >::iterator
+ ParamGenerator>::iterator
it = gen.begin();
EXPECT_EQ(0, std::get<0>(*it));
@@ -523,6 +524,63 @@ TEST(CombineTest, NonDefaultConstructAssign) {
EXPECT_TRUE(it == gen.end());
}
+template
+class ConstructFromT {
+ public:
+ ConstructFromT(const T& t) : t_(t) {}
+ template
+ ConstructFromT(Args&&... args) : t_(std::forward(args)...) {}
+
+ bool operator==(const ConstructFromT& other) const { return other.t_ == t_; }
+
+ const T& get() const { return t_; }
+
+ private:
+ T t_;
+};
+
+TEST(ConvertTest, CombineWithTwoParameters) {
+ const char* foo = "foo";
+ const char* bar = "bar";
+ const ParamGenerator>> gen =
+ ConvertGenerator>(
+ Combine(Values(foo, bar), Values(3, 4)));
+
+ ConstructFromT> expected_values[] = {
+ {foo, 3}, {foo, 4}, {bar, 3}, {bar, 4}};
+ VerifyGenerator(gen, expected_values);
+}
+
+TEST(ConvertTest, NonDefaultConstructAssign) {
+ const ParamGenerator<
+ ConstructFromT>>
+ gen = ConvertGenerator>(
+ Combine(Values(0, 1), Values(NonDefaultConstructAssignString("A"),
+ NonDefaultConstructAssignString("B"))));
+
+ ParamGenerator>>::iterator it =
+ gen.begin();
+
+ EXPECT_EQ(0, std::get<0>(it->get()));
+ EXPECT_EQ("A", std::get<1>(it->get()).str());
+ ++it;
+
+ EXPECT_EQ(0, std::get<0>(it->get()));
+ EXPECT_EQ("B", std::get<1>(it->get()).str());
+ ++it;
+
+ EXPECT_EQ(1, std::get<0>(it->get()));
+ EXPECT_EQ("A", std::get<1>(it->get()).str());
+ ++it;
+
+ EXPECT_EQ(1, std::get<0>(it->get()));
+ EXPECT_EQ("B", std::get<1>(it->get()).str());
+ ++it;
+
+ EXPECT_TRUE(it == gen.end());
+}
+
// Tests that an generator produces correct sequence after being
// assigned from another generator.
TEST(ParamGeneratorTest, AssignmentWorks) {
From 5b909beeec178f338be997830b6c31a80cda7a93 Mon Sep 17 00:00:00 2001
From: Dino Radakovic
Date: Thu, 4 Aug 2022 10:53:26 -0700
Subject: [PATCH 29/56] Explicitly instantiate matchee std::string in
MatchesRegex
If this ever turns out to be a performance issue, we could use std::conditional and std::is_same to avoid copying std::strings.
Fixes #3949
PiperOrigin-RevId: 465353572
Change-Id: If2d691bccb626c692c87e006df5afe88a4ed1542
---
googletest/include/gtest/gtest-matchers.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h
index bffa00c5..4a60b0d0 100644
--- a/googletest/include/gtest/gtest-matchers.h
+++ b/googletest/include/gtest/gtest-matchers.h
@@ -842,7 +842,7 @@ class MatchesRegexMatcher {
template
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {
- const std::string& s2(s);
+ const std::string s2(s);
return full_match_ ? RE::FullMatch(s2, *regex_)
: RE::PartialMatch(s2, *regex_);
}
From 4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774 Mon Sep 17 00:00:00 2001
From: Dino Radakovic
Date: Mon, 8 Aug 2022 11:47:36 -0700
Subject: [PATCH 30/56] gtest_unittest: Call FAIL() in lambda, fix incorrect
fatality expectation
FAIL() evaluates into a return statement: https://github.com/google/googletest/blob/5b909beeec178f338be997830b6c31a80cda7a93/googletest/include/gtest/internal/gtest-internal.h#L1347
Calling it from the body of the test case turns all subsequent expectations into no-ops.
Fixes #3941
PiperOrigin-RevId: 466104977
Change-Id: Ic15f43acb734295a5c9690a2b5eec6f65e8c0814
---
googletest/test/gtest_unittest.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index b579e81e..329ca546 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -3454,10 +3454,10 @@ TEST_F(NoFatalFailureTest, MessageIsStreamable) {
TestPartResultArray gtest_failures;
{
ScopedFakeTestPartResultReporter gtest_reporter(>est_failures);
- EXPECT_NO_FATAL_FAILURE(FAIL() << "foo") << "my message";
+ EXPECT_NO_FATAL_FAILURE([] { FAIL() << "foo"; }()) << "my message";
}
ASSERT_EQ(2, gtest_failures.size());
- EXPECT_EQ(TestPartResult::kNonFatalFailure,
+ EXPECT_EQ(TestPartResult::kFatalFailure,
gtest_failures.GetTestPartResult(0).type());
EXPECT_EQ(TestPartResult::kNonFatalFailure,
gtest_failures.GetTestPartResult(1).type());
From 7274ec186442c96e4c7dcc99c684a03e5db2ff48 Mon Sep 17 00:00:00 2001
From: Derek Mauro
Date: Fri, 12 Aug 2022 10:46:04 -0700
Subject: [PATCH 31/56] Add --features=external_include_paths to Bazel CI to
ignore warnings from dependencies
PiperOrigin-RevId: 467244441
Change-Id: Iefa65474d8c62e7c4c942957dc8e275715076e5f
---
.github/workflows/gtest-ci.yml | 6 +++---
ci/linux-presubmit.sh | 3 +++
ci/macos-presubmit.sh | 1 +
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml
index 036c392f..b2dcab49 100644
--- a/.github/workflows/gtest-ci.yml
+++ b/.github/workflows/gtest-ci.yml
@@ -17,7 +17,7 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --test_output=errors //...
+ run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
MacOs:
runs-on: macos-latest
@@ -28,7 +28,7 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --test_output=errors //...
+ run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
Windows:
@@ -40,4 +40,4 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --test_output=errors //...
+ run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh
index f7e0f465..4eb5bbe4 100644
--- a/ci/linux-presubmit.sh
+++ b/ci/linux-presubmit.sh
@@ -80,6 +80,7 @@ time docker run \
--copt="-Wuninitialized" \
--copt="-Wno-error=pragmas" \
--distdir="/bazel-distdir" \
+ --features=external_include_paths \
--keep_going \
--show_timestamps \
--test_output=errors
@@ -100,6 +101,7 @@ for std in ${STD}; do
--copt="-Wuninitialized" \
--define="absl=${absl}" \
--distdir="/bazel-distdir" \
+ --features=external_include_paths \
--keep_going \
--show_timestamps \
--test_output=errors
@@ -123,6 +125,7 @@ for std in ${STD}; do
--copt="-Wuninitialized" \
--define="absl=${absl}" \
--distdir="/bazel-distdir" \
+ --features=external_include_paths \
--keep_going \
--linkopt="--gcc-toolchain=/usr/local" \
--show_timestamps \
diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh
index 3b711da5..8f35df58 100644
--- a/ci/macos-presubmit.sh
+++ b/ci/macos-presubmit.sh
@@ -68,6 +68,7 @@ for absl in 0 1; do
--copt="-Werror" \
--cxxopt="-std=c++14" \
--define="absl=${absl}" \
+ --features=external_include_paths \
--keep_going \
--show_timestamps \
--test_output=errors
From c0e032efe587efa99413dd9ac54c3953a7915588 Mon Sep 17 00:00:00 2001
From: Derek Mauro
Date: Tue, 16 Aug 2022 10:23:11 -0700
Subject: [PATCH 32/56] Update README.md to point to the Foundational C++
Support Policy
PiperOrigin-RevId: 467959285
Change-Id: Ibd92b3a278f293736b31bd7e07fe502241bb1f05
---
README.md | 39 ++++++---------------------------------
1 file changed, 6 insertions(+), 33 deletions(-)
diff --git a/README.md b/README.md
index 5061357e..cd89abb2 100644
--- a/README.md
+++ b/README.md
@@ -59,39 +59,12 @@ More information about building GoogleTest can be found at
## Supported Platforms
-GoogleTest requires a codebase and compiler compliant with the C++14 standard or
-newer.
-
-The GoogleTest code is officially supported on the following platforms.
-Operating systems or tools not listed below are community-supported. For
-community-supported platforms, patches that do not complicate the code may be
-considered.
-
-If you notice any problems on your platform, please file an issue on the
-[GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues).
-Pull requests containing fixes are welcome!
-
-### Operating Systems
-
-* Linux
-* macOS
-* Windows
-
-### Compilers
-
-* gcc 5.0+
-* clang 5.0+
-* MSVC 2015+
-
-**macOS users:** Xcode 9.3+ provides clang 5.0+.
-
-### Build Systems
-
-* [Bazel](https://bazel.build/)
-* [CMake](https://cmake.org/)
-
-**Note:** Bazel is the build system used by the team internally and in tests.
-CMake is supported on a best-effort basis and by the community.
+GoogleTest follows Google's
+[Foundational C++ Support Policy](https://opensource.google/documentation/policies/cplusplus-support).
+See
+[this table](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)
+for a list of currently supported versions compilers, platforms, and build
+tools.
## Who Is Using GoogleTest?
From 91c3669f21cf569f13bd15569b5411e6ca9a8961 Mon Sep 17 00:00:00 2001
From: Keith Smiley
Date: Fri, 19 Aug 2022 11:10:56 -0700
Subject: [PATCH 33/56] bazel: move -std=c++14 to .bazelrc
Bazel defaults to -std=c++11 on macOS which gtest doesn't support.
---
.bazelrc | 1 +
.github/workflows/gtest-ci.yml | 9 +++------
ci/linux-presubmit.sh | 1 -
ci/macos-presubmit.sh | 1 -
4 files changed, 4 insertions(+), 8 deletions(-)
create mode 100644 .bazelrc
diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 00000000..f93facf0
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1 @@
+build --cxxopt=-std=c++14
diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml
index b2dcab49..e61880f9 100644
--- a/.github/workflows/gtest-ci.yml
+++ b/.github/workflows/gtest-ci.yml
@@ -4,9 +4,6 @@ on:
push:
pull_request:
-env:
- BAZEL_CXXOPTS: -std=c++14
-
jobs:
Linux:
runs-on: ubuntu-latest
@@ -17,7 +14,7 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
+ run: bazel test --features=external_include_paths --test_output=errors ...
MacOs:
runs-on: macos-latest
@@ -28,7 +25,7 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
+ run: bazel test --features=external_include_paths --test_output=errors ...
Windows:
@@ -40,4 +37,4 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
+ run: bazel test --features=external_include_paths --test_output=errors ...
diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh
index 4eb5bbe4..f6eb9b7d 100644
--- a/ci/linux-presubmit.sh
+++ b/ci/linux-presubmit.sh
@@ -72,7 +72,6 @@ time docker run \
--workdir="/src" \
--rm \
--env="CC=/usr/local/bin/gcc" \
- --env="BAZEL_CXXOPTS=-std=c++14" \
${LINUX_GCC_FLOOR_CONTAINER} \
/usr/local/bin/bazel test ... \
--copt="-Wall" \
diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh
index 8f35df58..a5d6635a 100644
--- a/ci/macos-presubmit.sh
+++ b/ci/macos-presubmit.sh
@@ -66,7 +66,6 @@ for absl in 0 1; do
${BAZEL_BIN} test ... \
--copt="-Wall" \
--copt="-Werror" \
- --cxxopt="-std=c++14" \
--define="absl=${absl}" \
--features=external_include_paths \
--keep_going \
From 25cc5777a17820a6339204a3552aa1dd5e428669 Mon Sep 17 00:00:00 2001
From: Hardik Vala
Date: Mon, 22 Aug 2022 06:42:26 -0700
Subject: [PATCH 34/56] Add support of 19-member structs to gmock
UnpackStructImpl.
PiperOrigin-RevId: 469171380
Change-Id: Ic75fc0523924e40e620552d4c04b79dad22a68e0
---
googlemock/include/gmock/gmock-matchers.h | 5 +++++
googlemock/test/gmock-matchers-comparisons_test.cc | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 46157360..5faf8dc9 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -3245,6 +3245,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<18>, char) {
const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = t;
return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r);
}
+template
+auto UnpackStructImpl(const T& t, MakeIndexSequence<19>, char) {
+ const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s] = t;
+ return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s);
+}
#endif // defined(__cpp_structured_bindings)
template
diff --git a/googlemock/test/gmock-matchers-comparisons_test.cc b/googlemock/test/gmock-matchers-comparisons_test.cc
index 1c6cac62..0cf731ff 100644
--- a/googlemock/test/gmock-matchers-comparisons_test.cc
+++ b/googlemock/test/gmock-matchers-comparisons_test.cc
@@ -1720,6 +1720,11 @@ TEST(FieldsAreTest, StructuredBindings) {
};
EXPECT_THAT(MyVarType18{},
FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0));
+ struct MyVarType19 {
+ int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s;
+ };
+ EXPECT_THAT(MyVarType19{}, FieldsAre(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0));
}
#endif
From afd902e992b720d1b3e106bc5e425a5768872265 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Fri, 26 Aug 2022 06:34:54 -0700
Subject: [PATCH 35/56] Consider all TERM values ending in "-256color" to be
color supporting. In particular this handles TERM=hterm-256color correctly.
PiperOrigin-RevId: 470232889
Change-Id: Iea594a3fde2b8b0a10e527956d70ba0bb3452e08
---
googletest/src/gtest.cc | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 513a8878..81409a33 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -3245,18 +3245,15 @@ bool ShouldUseColor(bool stdout_is_tty) {
#else
// On non-Windows platforms, we rely on the TERM variable.
const char* const term = posix::GetEnv("TERM");
- const bool term_supports_color =
+ const bool term_supports_color = term != nullptr && (
String::CStringEquals(term, "xterm") ||
String::CStringEquals(term, "xterm-color") ||
- String::CStringEquals(term, "xterm-256color") ||
String::CStringEquals(term, "screen") ||
- String::CStringEquals(term, "screen-256color") ||
String::CStringEquals(term, "tmux") ||
- String::CStringEquals(term, "tmux-256color") ||
String::CStringEquals(term, "rxvt-unicode") ||
- String::CStringEquals(term, "rxvt-unicode-256color") ||
String::CStringEquals(term, "linux") ||
- String::CStringEquals(term, "cygwin");
+ String::CStringEquals(term, "cygwin") ||
+ String::EndsWithCaseInsensitive(term, "-256color"));
return stdout_is_tty && term_supports_color;
#endif // GTEST_OS_WINDOWS
}
From 0e0d9feefab1b51aaab9dfd70132e93c0b6964e5 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Thu, 1 Sep 2022 07:24:20 -0700
Subject: [PATCH 36/56] Fixed header guards to match style guide conventions.
PiperOrigin-RevId: 471524660
Change-Id: Ie11e6a7a5a5497f64d5b9c382f1017094e043093
---
googlemock/include/gmock/gmock-function-mocker.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/googlemock/include/gmock/gmock-function-mocker.h b/googlemock/include/gmock/gmock-function-mocker.h
index f565d980..b568aefe 100644
--- a/googlemock/include/gmock/gmock-function-mocker.h
+++ b/googlemock/include/gmock/gmock-function-mocker.h
@@ -34,8 +34,8 @@
// IWYU pragma: private, include "gmock/gmock.h"
// IWYU pragma: friend gmock/.*
-#ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
-#define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
+#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
+#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
#include // IWYU pragma: keep
#include // IWYU pragma: keep
@@ -511,4 +511,4 @@ using internal::FunctionMocker;
#define GMOCK_MOCKER_(arity, constness, Method) \
GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
-#endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_
+#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_
From 0f6885405c980d5479d6177f7223d4bc7bacca6b Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Thu, 8 Sep 2022 09:41:57 -0700
Subject: [PATCH 37/56] Remove obsolete MSVC warning pragmas for Invalid()
Remove the MSVC pragmas for disabling warning C4717 (infinite recursion) for
Invalid() because that warning has been fixed in cl/441474979.
PiperOrigin-RevId: 473012585
Change-Id: I5f1bf88379bd4f2bf005e029c04766ac4caadd84
---
.../include/gmock/internal/gmock-internal-utils.h | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index b1343fdc..92d8eb9d 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -290,13 +290,6 @@ class WithoutMatchers {
// Internal use only: access the singleton instance of WithoutMatchers.
GTEST_API_ WithoutMatchers GetWithoutMatchers();
-// Disable MSVC warnings for infinite recursion, since in this case the
-// recursion is unreachable.
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable : 4717)
-#endif
-
// Invalid() is usable as an expression of type T, but will terminate
// the program with an assertion failure if actually run. This is useful
// when a value of type T is needed for compilation, but the statement
@@ -314,10 +307,6 @@ inline T Invalid() {
#endif
}
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
// Given a raw type (i.e. having no top-level reference or const
// modifier) RawContainer that's either an STL-style container or a
// native array, class StlContainerView has the
From c29315dda476f195298ab8da180e564478649b9e Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Fri, 9 Sep 2022 15:14:20 -0700
Subject: [PATCH 38/56] Use UnorderedElementsAre in example about using
matchers with maps
PiperOrigin-RevId: 473353707
Change-Id: Ief5bdbd2b8e28bac8f47be9aaeac4bb93875a793
---
docs/gmock_cook_book.md | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/docs/gmock_cook_book.md b/docs/gmock_cook_book.md
index 8a11d864..5be298d3 100644
--- a/docs/gmock_cook_book.md
+++ b/docs/gmock_cook_book.md
@@ -1424,11 +1424,12 @@ Use `Pair` when comparing maps or other associative containers.
{% raw %}
```cpp
-using testing::ElementsAre;
-using testing::Pair;
+using ::testing::UnorderedElementsAre;
+using ::testing::Pair;
...
- std::map m = {{"a", 1}, {"b", 2}, {"c", 3}};
- EXPECT_THAT(m, ElementsAre(Pair("a", 1), Pair("b", 2), Pair("c", 3)));
+ absl::flat_hash_map m = {{"a", 1}, {"b", 2}, {"c", 3}};
+ EXPECT_THAT(m, UnorderedElementsAre(
+ Pair("a", 1), Pair("b", 2), Pair("c", 3)));
```
{% endraw %}
@@ -1445,8 +1446,8 @@ using testing::Pair;
* If the container is passed by pointer instead of by reference, just write
`Pointee(ElementsAre*(...))`.
* The order of elements *matters* for `ElementsAre*()`. If you are using it
- with containers whose element order are undefined (e.g. `hash_map`) you
- should use `WhenSorted` around `ElementsAre`.
+ with containers whose element order are undefined (such as a
+ `std::unordered_map`) you should use `UnorderedElementsAre`.
### Sharing Matchers
From 7cafeff7bddf0430ae1e68ebb6213bb7c5d4a8ec Mon Sep 17 00:00:00 2001
From: Derek Mauro
Date: Tue, 13 Sep 2022 08:14:45 -0700
Subject: [PATCH 39/56] Rollback 4fa8cfe3f4dee8975ee02d98633a5245ab67c6d7
Breaks the intended C++ version on some CI builds
PiperOrigin-RevId: 474022587
Change-Id: I41a58893802c90864e0f2cc3d15e6c169c59146d
---
.bazelrc | 1 -
.github/workflows/gtest-ci.yml | 9 ++++++---
ci/linux-presubmit.sh | 1 +
ci/macos-presubmit.sh | 1 +
4 files changed, 8 insertions(+), 4 deletions(-)
delete mode 100644 .bazelrc
diff --git a/.bazelrc b/.bazelrc
deleted file mode 100644
index f93facf0..00000000
--- a/.bazelrc
+++ /dev/null
@@ -1 +0,0 @@
-build --cxxopt=-std=c++14
diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml
index e61880f9..b2dcab49 100644
--- a/.github/workflows/gtest-ci.yml
+++ b/.github/workflows/gtest-ci.yml
@@ -4,6 +4,9 @@ on:
push:
pull_request:
+env:
+ BAZEL_CXXOPTS: -std=c++14
+
jobs:
Linux:
runs-on: ubuntu-latest
@@ -14,7 +17,7 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --features=external_include_paths --test_output=errors ...
+ run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
MacOs:
runs-on: macos-latest
@@ -25,7 +28,7 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --features=external_include_paths --test_output=errors ...
+ run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
Windows:
@@ -37,4 +40,4 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --features=external_include_paths --test_output=errors ...
+ run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
diff --git a/ci/linux-presubmit.sh b/ci/linux-presubmit.sh
index f6eb9b7d..4eb5bbe4 100644
--- a/ci/linux-presubmit.sh
+++ b/ci/linux-presubmit.sh
@@ -72,6 +72,7 @@ time docker run \
--workdir="/src" \
--rm \
--env="CC=/usr/local/bin/gcc" \
+ --env="BAZEL_CXXOPTS=-std=c++14" \
${LINUX_GCC_FLOOR_CONTAINER} \
/usr/local/bin/bazel test ... \
--copt="-Wall" \
diff --git a/ci/macos-presubmit.sh b/ci/macos-presubmit.sh
index a5d6635a..8f35df58 100644
--- a/ci/macos-presubmit.sh
+++ b/ci/macos-presubmit.sh
@@ -66,6 +66,7 @@ for absl in 0 1; do
${BAZEL_BIN} test ... \
--copt="-Wall" \
--copt="-Werror" \
+ --cxxopt="-std=c++14" \
--define="absl=${absl}" \
--features=external_include_paths \
--keep_going \
From 1336c4b6d1a6f4bc6beebccb920e5ff858889292 Mon Sep 17 00:00:00 2001
From: Derek Mauro
Date: Tue, 13 Sep 2022 10:12:42 -0700
Subject: [PATCH 40/56] Fix MSVC C++14 flag for GitHub workflow
PiperOrigin-RevId: 474053482
Change-Id: If5cdf7458139ba3ad04b8c078734d6890199a348
---
.github/workflows/gtest-ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml
index b2dcab49..bcef926b 100644
--- a/.github/workflows/gtest-ci.yml
+++ b/.github/workflows/gtest-ci.yml
@@ -40,4 +40,4 @@ jobs:
fetch-depth: 0
- name: Tests
- run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
+ run: bazel test --cxxopt=/std:c++14 --features=external_include_paths --test_output=errors ...
From 05cc575c65924b83535b6d35fc39a1981b458bef Mon Sep 17 00:00:00 2001
From: John Hinnegan <426690+softwaregravy@users.noreply.github.com>
Date: Sun, 18 Sep 2022 10:54:36 -0400
Subject: [PATCH 41/56] Update link to Bazel installation guide
The Bazel docs have moved!
---
docs/quickstart-bazel.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/quickstart-bazel.md b/docs/quickstart-bazel.md
index c187e729..853139a9 100644
--- a/docs/quickstart-bazel.md
+++ b/docs/quickstart-bazel.md
@@ -17,7 +17,7 @@ See [Supported Platforms](platforms.md) for more information about platforms
compatible with GoogleTest.
If you don't already have Bazel installed, see the
-[Bazel installation guide](https://docs.bazel.build/versions/main/install.html).
+[Bazel installation guide](https://bazel.build/install).
{: .callout .note}
Note: The terminal commands in this tutorial show a Unix shell prompt, but the
From 7a3abfec0aa5255f0ecf246987422493e9ca6a75 Mon Sep 17 00:00:00 2001
From: Marat Dukhan
Date: Tue, 20 Sep 2022 23:07:33 -0700
Subject: [PATCH 42/56] Port GoogleTest to QuRT (Hexagon RTOS)
---
googlemock/src/gmock-spec-builders.cc | 7 ++++++
.../include/gtest/internal/gtest-port-arch.h | 2 ++
.../include/gtest/internal/gtest-port.h | 25 +++++++++++++------
googletest/src/gtest-filepath.cc | 4 +--
googletest/src/gtest_main.cc | 12 +++++++++
5 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc
index 1771e403..b333e53d 100644
--- a/googlemock/src/gmock-spec-builders.cc
+++ b/googlemock/src/gmock-spec-builders.cc
@@ -51,6 +51,9 @@
#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
#include // NOLINT
#endif
+#if GTEST_OS_QURT
+#include
+#endif
// Silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 15
@@ -519,8 +522,12 @@ class MockObjectRegistry {
// RUN_ALL_TESTS() has already returned when this destructor is
// called. Therefore we cannot use the normal Google Test
// failure reporting mechanism.
+#if GTEST_OS_QURT
+ qurt_exception_raise_fatal();
+#else
_exit(1); // We cannot call exit() as it is not reentrant and
// may already have been called.
+#endif
}
}
diff --git a/googletest/include/gtest/internal/gtest-port-arch.h b/googletest/include/gtest/internal/gtest-port-arch.h
index f025db76..04064606 100644
--- a/googletest/include/gtest/internal/gtest-port-arch.h
+++ b/googletest/include/gtest/internal/gtest-port-arch.h
@@ -111,6 +111,8 @@
#define GTEST_OS_ESP32 1
#elif defined(__XTENSA__)
#define GTEST_OS_XTENSA 1
+#elif defined(__hexagon__)
+#define GTEST_OS_QURT 1
#endif // __CYGWIN__
#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index c9e1f324..025d3d47 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -385,7 +385,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// On Android, is only available starting with Gingerbread.
#define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9)
#else
-#define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS && !GTEST_OS_XTENSA)
+#define GTEST_HAS_POSIX_RE \
+ !(GTEST_OS_WINDOWS || GTEST_OS_XTENSA || GTEST_OS_QURT)
#endif
#endif
@@ -457,7 +458,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// no support for it at least as recent as Froyo (2.2).
#define GTEST_HAS_STD_WSTRING \
(!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
- GTEST_OS_HAIKU || GTEST_OS_ESP32 || GTEST_OS_ESP8266 || GTEST_OS_XTENSA))
+ GTEST_OS_HAIKU || GTEST_OS_ESP32 || GTEST_OS_ESP8266 || \
+ GTEST_OS_XTENSA || GTEST_OS_QURT))
#endif // GTEST_HAS_STD_WSTRING
@@ -578,9 +580,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
// output correctness and to implement death tests.
#ifndef GTEST_HAS_STREAM_REDIRECTION
// By default, we assume that stream redirection is supported on all
-// platforms except known mobile ones.
+// platforms except known mobile / embedded ones.
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
- GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA
+ GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA || GTEST_OS_QURT
#define GTEST_HAS_STREAM_REDIRECTION 0
#else
#define GTEST_HAS_STREAM_REDIRECTION 1
@@ -2019,7 +2021,12 @@ inline int StrCaseCmp(const char* s1, const char* s2) {
return strcasecmp(s1, s2);
}
inline char* StrDup(const char* src) { return strdup(src); }
+#if GTEST_OS_QURT
+// QuRT doesn't support any directory functions, including rmdir
+inline int RmDir(const char* dir GTEST_ATTRIBUTE_UNUSED_) { return 0; }
+#else
inline int RmDir(const char* dir) { return rmdir(dir); }
+#endif
inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
#endif // GTEST_OS_WINDOWS
@@ -2044,7 +2051,8 @@ GTEST_DISABLE_MSC_DEPRECATED_PUSH_()
// defined there.
#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && \
- !GTEST_OS_WINDOWS_RT && !GTEST_OS_ESP8266 && !GTEST_OS_XTENSA
+ !GTEST_OS_WINDOWS_RT && !GTEST_OS_ESP8266 && !GTEST_OS_XTENSA && \
+ !GTEST_OS_QURT
inline int ChDir(const char* dir) { return chdir(dir); }
#endif
inline FILE* FOpen(const char* path, const char* mode) {
@@ -2058,14 +2066,14 @@ inline FILE* FOpen(const char* path, const char* mode) {
return fopen(path, mode);
#endif // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MINGW
}
-#if !GTEST_OS_WINDOWS_MOBILE
+#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_QURT
inline FILE* FReopen(const char* path, const char* mode, FILE* stream) {
return freopen(path, mode, stream);
}
inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
#endif
inline int FClose(FILE* fp) { return fclose(fp); }
-#if !GTEST_OS_WINDOWS_MOBILE
+#if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_QURT
inline int Read(int fd, void* buf, unsigned int count) {
return static_cast(read(fd, buf, count));
}
@@ -2077,7 +2085,8 @@ inline const char* StrError(int errnum) { return strerror(errnum); }
#endif
inline const char* GetEnv(const char* name) {
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
- GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA
+ GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_XTENSA || \
+ GTEST_OS_QURT
// We are on an embedded platform, which has no environment variables.
static_cast(name); // To prevent 'unused argument' warning.
return nullptr;
diff --git a/googletest/src/gtest-filepath.cc b/googletest/src/gtest-filepath.cc
index f6ee90cd..6767db0d 100644
--- a/googletest/src/gtest-filepath.cc
+++ b/googletest/src/gtest-filepath.cc
@@ -96,7 +96,7 @@ static bool IsPathSeparator(char c) {
FilePath FilePath::GetCurrentDir() {
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || \
GTEST_OS_WINDOWS_RT || GTEST_OS_ESP8266 || GTEST_OS_ESP32 || \
- GTEST_OS_XTENSA
+ GTEST_OS_XTENSA || GTEST_OS_QURT
// These platforms do not have a current directory, so we just return
// something reasonable.
return FilePath(kCurrentDirectoryString);
@@ -323,7 +323,7 @@ bool FilePath::CreateFolder() const {
delete[] unicode;
#elif GTEST_OS_WINDOWS
int result = _mkdir(pathname_.c_str());
-#elif GTEST_OS_ESP8266 || GTEST_OS_XTENSA
+#elif GTEST_OS_ESP8266 || GTEST_OS_XTENSA || GTEST_OS_QURT
// do nothing
int result = 0;
#else
diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc
index 44976375..d2260488 100644
--- a/googletest/src/gtest_main.cc
+++ b/googletest/src/gtest_main.cc
@@ -32,9 +32,12 @@
#include "gtest/gtest.h"
#if GTEST_OS_ESP8266 || GTEST_OS_ESP32
+// Aduino-like platforms: program entry points are setup/loop instead of main.
+
#if GTEST_OS_ESP8266
extern "C" {
#endif
+
void setup() { testing::InitGoogleTest(); }
void loop() { RUN_ALL_TESTS(); }
@@ -43,7 +46,16 @@ void loop() { RUN_ALL_TESTS(); }
}
#endif
+#elif GTEST_OS_QURT
+// QuRT: program entry point is main, but argc/argv are unusable.
+
+GTEST_API_ int main() {
+ printf("Running main() from %s\n", __FILE__);
+ testing::InitGoogleTest();
+ return RUN_ALL_TESTS();
+}
#else
+// Normal platforms: program entry point is main, argc/argv are initialized.
GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from %s\n", __FILE__);
From 83bd792e36db826f869f30ded6c6acc82c4fe672 Mon Sep 17 00:00:00 2001
From: Christian Clauss
Date: Tue, 27 Sep 2022 12:44:59 +0200
Subject: [PATCH 43/56] Upgrade GitHub Actions Checkout
https://github.com/actions/checkout/releases
---
.github/workflows/gtest-ci.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml
index bcef926b..7ace9509 100644
--- a/.github/workflows/gtest-ci.yml
+++ b/.github/workflows/gtest-ci.yml
@@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
@@ -23,7 +23,7 @@ jobs:
runs-on: macos-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
@@ -35,7 +35,7 @@ jobs:
runs-on: windows-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
From 9836817d8256faf4829e2046c4a391df4b7cc54c Mon Sep 17 00:00:00 2001
From: Christian Clauss
Date: Tue, 27 Sep 2022 12:47:32 +0200
Subject: [PATCH 44/56] Branding: macOS
---
.github/workflows/gtest-ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/gtest-ci.yml b/.github/workflows/gtest-ci.yml
index 7ace9509..03a8cc5e 100644
--- a/.github/workflows/gtest-ci.yml
+++ b/.github/workflows/gtest-ci.yml
@@ -19,7 +19,7 @@ jobs:
- name: Tests
run: bazel test --cxxopt=-std=c++14 --features=external_include_paths --test_output=errors ...
- MacOs:
+ macOS:
runs-on: macos-latest
steps:
From dfa67352364e00452360e1fa5d59677459712ee7 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Tue, 27 Sep 2022 12:08:58 -0700
Subject: [PATCH 45/56] Add GoogleTest workaround for MSVC crash with Address
Sanitizer (ASAN) on version 17.3.3
PiperOrigin-RevId: 477240422
Change-Id: I894037850617252e462783c0885e30fc8e7ad122
---
googletest/src/gtest.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 81409a33..43e8723b 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -2713,7 +2713,8 @@ TestInfo::TestInfo(const std::string& a_test_suite_name,
internal::TypeId fixture_class_id,
internal::TestFactoryBase* factory)
: test_suite_name_(a_test_suite_name),
- name_(a_name),
+ // begin()/end() is MSVC 17.3.3 ASAN crash workaround (GitHub issue #3997)
+ name_(a_name.begin(), a_name.end()),
type_param_(a_type_param ? new std::string(a_type_param) : nullptr),
value_param_(a_value_param ? new std::string(a_value_param) : nullptr),
location_(a_code_location),
From 4924e0610a89dcd58077a691a2e3702b0d6e58ed Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Wed, 28 Sep 2022 11:55:06 -0700
Subject: [PATCH 46/56] Moves boilerplate disabling copy constructor/assignment
from GoogleTest's TEST_P macro into a header file to avoid triggering
warnings in user code.
Fixes #4015
PiperOrigin-RevId: 477513399
Change-Id: Ia21928ee12e85946b4c8db86835d225cb257eecc
---
googletest/include/gtest/gtest-param-test.h | 7 +------
googletest/include/gtest/gtest.h | 15 +++++++++++++++
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h
index b55119ac..19238ae4 100644
--- a/googletest/include/gtest/gtest-param-test.h
+++ b/googletest/include/gtest/gtest-param-test.h
@@ -409,7 +409,7 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
#define TEST_P(test_suite_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
- : public test_suite_name { \
+ : public ::testing::internal::UserTestSuite { \
public: \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
void TestBody() override; \
@@ -429,11 +429,6 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
return 0; \
} \
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
- GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
- (const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
- GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
- const GTEST_TEST_CLASS_NAME_(test_suite_name, \
- test_name) &) = delete; /* NOLINT */ \
}; \
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
test_name)::gtest_registering_dummy_ = \
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index d19a587a..6ff2774f 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -190,6 +190,21 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
const std::string& message);
std::set* GetIgnoredParameterizedTestSuites();
+// Mix-in class for user tests.
+// This allows us to add/delete members to/from test suites without having to
+// modify the test macros themselves.
+// This makes the code easier to read and maintain, as well making it easier
+// for users to suppress any warnings originating from these members, as the
+// members are now declared in an external header instead of in user code.
+template
+class UserTestSuite : public TestClass {
+ public:
+ UserTestSuite() = default;
+ UserTestSuite(const UserTestSuite &) = delete;
+ UserTestSuite &operator=(const UserTestSuite &) = delete;
+ virtual ~UserTestSuite() = default;
+};
+
} // namespace internal
// The friend relationship of some of these classes is cyclic.
From c43b916a9623e052860f59e52f71de1974ed8823 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Wed, 28 Sep 2022 14:14:25 -0700
Subject: [PATCH 47/56] Uses a simpler mechanism to disable the copying of
GoogleTest test suites.
PiperOrigin-RevId: 477549427
Change-Id: I6421ca09f0f1296cebdc3e54565049f1542dfa8a
---
googletest/include/gtest/gtest-param-test.h | 2 +-
googletest/include/gtest/gtest.h | 17 +++++------------
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h
index 19238ae4..2dbac48e 100644
--- a/googletest/include/gtest/gtest-param-test.h
+++ b/googletest/include/gtest/gtest-param-test.h
@@ -409,7 +409,7 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
#define TEST_P(test_suite_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
- : public ::testing::internal::UserTestSuite { \
+ : public test_suite_name, private ::testing::internal::NonCopyable { \
public: \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
void TestBody() override; \
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 6ff2774f..4f037ad7 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -190,19 +190,12 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
const std::string& message);
std::set* GetIgnoredParameterizedTestSuites();
-// Mix-in class for user tests.
-// This allows us to add/delete members to/from test suites without having to
-// modify the test macros themselves.
-// This makes the code easier to read and maintain, as well making it easier
-// for users to suppress any warnings originating from these members, as the
-// members are now declared in an external header instead of in user code.
-template
-class UserTestSuite : public TestClass {
+class NonCopyable {
public:
- UserTestSuite() = default;
- UserTestSuite(const UserTestSuite &) = delete;
- UserTestSuite &operator=(const UserTestSuite &) = delete;
- virtual ~UserTestSuite() = default;
+ NonCopyable() = default;
+ NonCopyable(const NonCopyable &) = delete;
+ NonCopyable &operator=(const NonCopyable &) = delete;
+ ~NonCopyable() = default;
};
} // namespace internal
From 19387c9dd5b153a6bdef6f1fc4fb2391fdb122d0 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Wed, 28 Sep 2022 14:58:29 -0700
Subject: [PATCH 48/56] Rollback: Uses a simpler mechanism to disable the
copying of GoogleTest test suites.
PiperOrigin-RevId: 477560280
Change-Id: I1c1f5a1d6645859ec38cb1a75cd267816d2aff35
---
googletest/include/gtest/gtest-param-test.h | 2 +-
googletest/include/gtest/gtest.h | 17 ++++++++++++-----
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h
index 2dbac48e..19238ae4 100644
--- a/googletest/include/gtest/gtest-param-test.h
+++ b/googletest/include/gtest/gtest-param-test.h
@@ -409,7 +409,7 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
#define TEST_P(test_suite_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
- : public test_suite_name, private ::testing::internal::NonCopyable { \
+ : public ::testing::internal::UserTestSuite { \
public: \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
void TestBody() override; \
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 4f037ad7..6ff2774f 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -190,12 +190,19 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
const std::string& message);
std::set* GetIgnoredParameterizedTestSuites();
-class NonCopyable {
+// Mix-in class for user tests.
+// This allows us to add/delete members to/from test suites without having to
+// modify the test macros themselves.
+// This makes the code easier to read and maintain, as well making it easier
+// for users to suppress any warnings originating from these members, as the
+// members are now declared in an external header instead of in user code.
+template
+class UserTestSuite : public TestClass {
public:
- NonCopyable() = default;
- NonCopyable(const NonCopyable &) = delete;
- NonCopyable &operator=(const NonCopyable &) = delete;
- ~NonCopyable() = default;
+ UserTestSuite() = default;
+ UserTestSuite(const UserTestSuite &) = delete;
+ UserTestSuite &operator=(const UserTestSuite &) = delete;
+ virtual ~UserTestSuite() = default;
};
} // namespace internal
From d1a0039b97291dd1dc14f123b906bb7622ffe07c Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Wed, 28 Sep 2022 15:24:12 -0700
Subject: [PATCH 49/56] Rollback: Moves boilerplate disabling copy
constructor/assignment from GoogleTest's TEST_P macro into a header file to
avoid triggering warnings in user code.
PiperOrigin-RevId: 477566426
Change-Id: Ia417e295d839f43be6e61a5699457866108f2a01
---
googletest/include/gtest/gtest-param-test.h | 7 ++++++-
googletest/include/gtest/gtest.h | 15 ---------------
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h
index 19238ae4..b55119ac 100644
--- a/googletest/include/gtest/gtest-param-test.h
+++ b/googletest/include/gtest/gtest-param-test.h
@@ -409,7 +409,7 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
#define TEST_P(test_suite_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
- : public ::testing::internal::UserTestSuite { \
+ : public test_suite_name { \
public: \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
void TestBody() override; \
@@ -429,6 +429,11 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
return 0; \
} \
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
+ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
+ (const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
+ GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
+ const GTEST_TEST_CLASS_NAME_(test_suite_name, \
+ test_name) &) = delete; /* NOLINT */ \
}; \
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
test_name)::gtest_registering_dummy_ = \
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index 6ff2774f..d19a587a 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -190,21 +190,6 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
const std::string& message);
std::set* GetIgnoredParameterizedTestSuites();
-// Mix-in class for user tests.
-// This allows us to add/delete members to/from test suites without having to
-// modify the test macros themselves.
-// This makes the code easier to read and maintain, as well making it easier
-// for users to suppress any warnings originating from these members, as the
-// members are now declared in an external header instead of in user code.
-template
-class UserTestSuite : public TestClass {
- public:
- UserTestSuite() = default;
- UserTestSuite(const UserTestSuite &) = delete;
- UserTestSuite &operator=(const UserTestSuite &) = delete;
- virtual ~UserTestSuite() = default;
-};
-
} // namespace internal
// The friend relationship of some of these classes is cyclic.
From 93f08be653c36ddc6943e9513fc14c7292b4d007 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Fri, 30 Sep 2022 10:54:41 -0700
Subject: [PATCH 50/56] Uses a simpler mechanism to disable the copying of
GoogleTest test suites, to move code out of the TEST_P macro.
PiperOrigin-RevId: 478031678
Change-Id: I45f0ce17a4add526c86b8212d836d98d63b3a193
---
googletest/include/gtest/gtest-param-test.h | 7 +------
googletest/include/gtest/gtest.h | 11 +++++++++++
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/googletest/include/gtest/gtest-param-test.h b/googletest/include/gtest/gtest-param-test.h
index b55119ac..2d38b96c 100644
--- a/googletest/include/gtest/gtest-param-test.h
+++ b/googletest/include/gtest/gtest-param-test.h
@@ -409,7 +409,7 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
#define TEST_P(test_suite_name, test_name) \
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
- : public test_suite_name { \
+ : public test_suite_name, private ::testing::internal::GTestNonCopyable {\
public: \
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
void TestBody() override; \
@@ -429,11 +429,6 @@ internal::CartesianProductHolder Combine(const Generator&... g) {
return 0; \
} \
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
- GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
- (const GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) &) = delete; \
- GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) & operator=( \
- const GTEST_TEST_CLASS_NAME_(test_suite_name, \
- test_name) &) = delete; /* NOLINT */ \
}; \
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
test_name)::gtest_registering_dummy_ = \
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index d19a587a..81e124fa 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -190,6 +190,17 @@ void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
const std::string& message);
std::set* GetIgnoredParameterizedTestSuites();
+// A base class that prevents subclasses from being copyable.
+// We do this instead of using '= delete' so as to avoid triggering warnings
+// inside user code regarding any of our declarations.
+class GTestNonCopyable {
+ public:
+ GTestNonCopyable() = default;
+ GTestNonCopyable(const GTestNonCopyable &) = delete;
+ GTestNonCopyable &operator=(const GTestNonCopyable &) = delete;
+ ~GTestNonCopyable() = default;
+};
+
} // namespace internal
// The friend relationship of some of these classes is cyclic.
From 08935483cb22749b3c3774e9bcd5ef35b5a1a7b7 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Wed, 5 Oct 2022 12:26:54 -0700
Subject: [PATCH 51/56] Makes Clang compilations via Ninja on Windows define
_DLL only for shared CRT builds, as one would already expect from MSVC
builds. (Previously, static Clang/Ninja builds on Windows also implicitly
defined _DLL, which was problematic.)
PiperOrigin-RevId: 479113168
Change-Id: I252d9be90fd33df75dab922e62b197208830d124
---
googletest/cmake/internal_utils.cmake | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index 6f7fdc2c..41405587 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -21,8 +21,9 @@ endif (POLICY CMP0054)
# This must be a macro(), as inside a function string() can only
# update variables in the function scope.
macro(fix_default_compiler_settings_)
- if (MSVC)
- # For MSVC, CMake sets certain flags to defaults we want to override.
+ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC|Clang")
+ # For MSVC and Clang, CMake sets certain flags to defaults we want to
+ # override.
# This replacement code is taken from sample in the CMake Wiki at
# https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace.
foreach (flag_var
@@ -39,6 +40,10 @@ macro(fix_default_compiler_settings_)
# on CRT DLLs being available. CMake always defaults to using shared
# CRT libraries, so we override that default here.
string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
+
+ # When using Ninja with Clang, static builds pass -D_DLL on Windows.
+ # This is incorrect and should not happen, so we fix that here.
+ string(REPLACE "-D_DLL" "" ${flag_var} "${${flag_var}}")
endif()
# We prefer more strict warning checking for building Google Test.
From 67e264834a45c3d543aa2fa11bcc41c4ba90316b Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Thu, 6 Oct 2022 11:21:49 -0700
Subject: [PATCH 52/56] [fuchsia] Use __builtin_trap to trigger
gunit_break_on_failure on non-x86 arch
In developing tests for the fuchsia debugger, it was found that in addition to catching gtest failures (which are implemented as software breakpoints) we also see PageFault exceptions, caused by this nullptr dereference.
PiperOrigin-RevId: 479365782
Change-Id: I84d805d94c2e46b6f3c982ca1ae49c6ac3ed3430
---
googletest/src/gtest.cc | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 43e8723b..638d53bb 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -143,6 +143,14 @@
#include "absl/strings/str_replace.h"
#endif // GTEST_HAS_ABSL
+// Checks builtin compiler feature |x| while avoiding an extra layer of #ifdefs
+// at the callsite.
+#if defined(__has_builtin)
+#define GTEST_HAS_BUILTIN(x) __has_builtin(x)
+#else
+#define GTEST_HAS_BUILTIN(x) 0
+#endif // defined(__has_builtin)
+
namespace testing {
using internal::CountIf;
@@ -5331,6 +5339,10 @@ void UnitTest::AddTestPartResult(TestPartResult::Type result_type,
(defined(__x86_64__) || defined(__i386__)))
// with clang/gcc we can achieve the same effect on x86 by invoking int3
asm("int3");
+#elif GTEST_HAS_BUILTIN(__builtin_trap)
+ __builtin_trap();
+#elif defined(SIGTRAP)
+ raise(SIGTRAP);
#else
// Dereference nullptr through a volatile pointer to prevent the compiler
// from removing. We use this rather than abort() or __builtin_trap() for
From 9fbb6575035e3ac97ad9547d042c026a1296c705 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Fri, 7 Oct 2022 14:20:15 -0700
Subject: [PATCH 53/56] Update the POSIX Extended section of the Regular
Expression Wikipedia page
PiperOrigin-RevId: 479667644
Change-Id: I4ab03bd5f0520f8586667de8bd1b9443f241337a
---
docs/advanced.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/advanced.md b/docs/advanced.md
index bce983c6..c3c54614 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -487,7 +487,7 @@ When built with Bazel and using Abseil, googletest uses the
systems (Linux, Cygwin, Mac), googletest uses the
[POSIX extended regular expression](http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap09.html#tag_09_04)
syntax. To learn about POSIX syntax, you may want to read this
-[Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_Extended_Regular_Expressions).
+[Wikipedia entry](http://en.wikipedia.org/wiki/Regular_expression#POSIX_extended).
On Windows, googletest uses its own simple regular expression implementation. It
lacks many features. For example, we don't support union (`"x|y"`), grouping
From 0231584a608bda1101c5f50ae03805c518ece93b Mon Sep 17 00:00:00 2001
From: Vertexwahn
Date: Sat, 8 Oct 2022 13:33:18 +0200
Subject: [PATCH 54/56] Update rules_python, bazel_skylib and platfroms
---
WORKSPACE | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/WORKSPACE b/WORKSPACE
index 4d7b3988..7e371b90 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -20,20 +20,25 @@ http_archive(
http_archive(
name = "rules_python",
- sha256 = "0b460f17771258341528753b1679335b629d1d25e3af28eda47d009c103a6e15",
- strip_prefix = "rules_python-aef17ad72919d184e5edb7abf61509eb78e57eda",
- urls = ["https://github.com/bazelbuild/rules_python/archive/aef17ad72919d184e5edb7abf61509eb78e57eda.zip"], # 2022-06-21T23:44:47Z
+ sha256 = "8c8fe44ef0a9afc256d1e75ad5f448bb59b81aba149b8958f02f7b3a98f5d9b4",
+ strip_prefix = "rules_python-0.13.0",
+ url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.13.0.tar.gz",
)
http_archive(
name = "bazel_skylib",
- urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz"],
- sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
+ ],
+ sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
)
http_archive(
name = "platforms",
- sha256 = "a879ea428c6d56ab0ec18224f976515948822451473a80d06c2e50af0bbe5121",
- strip_prefix = "platforms-da5541f26b7de1dc8e04c075c99df5351742a4a2",
- urls = ["https://github.com/bazelbuild/platforms/archive/da5541f26b7de1dc8e04c075c99df5351742a4a2.zip"], # 2022-05-27
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
+ "https://github.com/bazelbuild/platforms/releases/download/0.0.6/platforms-0.0.6.tar.gz",
+ ],
+ sha256 = "5308fc1d8865406a49427ba24a9ab53087f17f5266a7aabbfc28823f3916e1ca",
)
From 671cfb7dbf26363ea0fc11b7e813cda7c2a2912e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ferenc=20G=C3=A9czi?=
Date: Fri, 7 Oct 2022 00:00:00 +0000
Subject: [PATCH 55/56] Suggests a release with fixed CMakeLists.txt
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Ferenc Géczi
---
googletest/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/googletest/README.md b/googletest/README.md
index 75b3d526..3a82b1df 100644
--- a/googletest/README.md
+++ b/googletest/README.md
@@ -25,7 +25,7 @@ When building GoogleTest as a standalone project, the typical workflow starts
with
```
-git clone https://github.com/google/googletest.git -b release-1.12.0
+git clone https://github.com/google/googletest.git -b release-1.12.1
cd googletest # Main directory of the cloned repository.
mkdir build # Create a directory to hold the build output.
cd build
From d29b143bda80baad6fd3f5b523ed54f10eb0eea3 Mon Sep 17 00:00:00 2001
From: Abseil Team
Date: Wed, 12 Oct 2022 10:30:15 -0700
Subject: [PATCH 56/56] Workaround for Visual C++ error C2039 with
std::tuple_element_t.
Fixes #3931
PiperOrigin-RevId: 480659507
Change-Id: I6fabef63b1285189a06375227273d9de2456e37a
---
googlemock/include/gmock/gmock-actions.h | 12 ++++++++----
.../include/gmock/internal/gmock-internal-utils.h | 7 +++++++
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index 7e78c09a..aad07d51 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -1428,8 +1428,10 @@ struct WithArgsAction {
// MSVC complains about the I parameter pack not being
// expanded (error C3520) despite it being expanded in the
// type alias.
- OnceAction>::type...)>>::value,
+ // TupleElement is also an MSVC workaround.
+ // See its definition for details.
+ OnceAction>...)>>::value,
int>::type = 0>
operator OnceAction() && { // NOLINT
struct OA {
@@ -1453,8 +1455,10 @@ struct WithArgsAction {
// MSVC complains about the I parameter pack not being
// expanded (error C3520) despite it being expanded in the
// type alias.
- Action>::type...)>>::value,
+ // TupleElement is also an MSVC workaround.
+ // See its definition for details.
+ Action>...)>>::value,
int>::type = 0>
operator Action() const { // NOLINT
Action> converted(inner_action);
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index 92d8eb9d..2678920b 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -453,6 +453,13 @@ struct Function {
template
constexpr size_t Function::ArgumentCount;
+// Workaround for MSVC error C2039: 'type': is not a member of 'std'
+// when std::tuple_element is used.
+// See: https://github.com/google/googletest/issues/3931
+// Can be replaced with std::tuple_element_t in C++14.
+template
+using TupleElement = typename std::tuple_element::type;
+
bool Base64Unescape(const std::string& encoded, std::string* decoded);
#ifdef _MSC_VER