GoogleTest C++17 cleanups * Use `[[nodiscard]]` instead of GTEST_MUST_USE_RESULT_ * Use `[[maybe_unused]]` instead of GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED * Use `[[deprecated]]` instead of `GTEST_INTERNAL_DEPRECATED` * Remove `GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL`PiperOrigin-RevId: 729523519
Change-Id: Ia1b901cf9c0a0e148eec419ada0e0b56aba2dd3d
Property: Promote note to warningProperty() should not be used against member functions that you do not own. Make
this warning more prominent in matchers.md and add it to gmock-matchers.h.
PiperOrigin-RevId: 727753777
Change-Id: Idf9155103b04b98efc957ff0d0cf3a8d8662eb72
Require C++17Policy information:
https://opensource.google/documentation/policies/cplusplus-support#c_language_standard
https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md
Some small fixes are included for C++17 compatibility.
We had no tests for MSVC C++17 or C++20, so those tests that failed
and had no obvious fix are disabled and a tracking bug has been filed.
Pipe...
Remove empty glob pattern, which is now an error.It look like this may be a copy-paste bug from the root BUILD file.
PiperOrigin-RevId: 724062332
Change-Id: I8eda2275d996dd14693aee569254db28d9bc4f9d
Pull Regexp syntax out of Death test section in advanced.mdRegexps seem to have nothing in common with death tests, yet their description is planted right in the middle of the death test section.
This CL pulls the regexp section one level up and just before death tests.
PiperOrigin-RevId: 721817710
Change-Id: Idc52f450fb10960a590ceb1a70339f86d4478fe4
Fix extended regular expressions reference URL in advanced.mdThe original URL started with https://www.opengroup.org and fails to redirect to the reference page. According to Chrome's dev tools (Network tab), the response to that request is a HTTP 302 Found, with the new location being "balancer://pubs/onlinepubs/009695399/basedefs/xbd_chap09.html". Chrome does not know what to do with that and displays a blank page.
Changing the `www` subdomain to `pub...
Export testsuite properties as XML elements, not attributes.With this change, arbitrary property names in the testsuite no longer
cause the produced XML output to be ill-formed.
PiperOrigin-RevId: 721549090
Change-Id: Iedffa89bf914478f563c8f3b82cd50557762a665
Document unexpected interaction with death test error code and gmock.If you have a death test that uses mock objects, it's very likely that those mock objects are not properly cleaned up before death. The gMock atexit leak detector will call `_exit(1)`, overriding your expected exit code.
PiperOrigin-RevId: 713722657
Change-Id: I92a326f3923efc9f0e235d825616f3094eca995c
gtest: Output a canned test case for test suite setup / teardown failures in XML/JSONThis surfaces useful information about the environment failure in a structured form.
As we can see from the updated test, previously unsurfaced information is now present.
PiperOrigin-RevId: 709892315
Change-Id: I2656294d50c33f995bef5c96195a66cff3c4b907
Put the fake Fuchsia SDK in a module extensionThis allows users to override the fake SDK with a real one using https://bazel.build/rules/lib/globals/module#override_repo.
Without this change, it is impossible for a project that depends on googletest as a `bazel_dep` to build tests using the "real" Fuchsia SDK, because any references to `@fuchsia_sdk` within googletest `BUILD.bazel` files unconditionally resolve to the "fake" Fuchsia SDK. ...
Add support for printing C++20 std::*_ordering types to gtest. Adds feature test macro for C++20 <compare> header, a pretty-printer, and tests. Inexplicably, these types aren't enums, so can't be handled with a switch.PiperOrigin-RevId: 704783038
Change-Id: I29688989d18f43520fe610c12a447a20d2f98c95
Use FAIL() in GTEST_SKIP() documentationThis replaces EXPECT_EQ(0, 1) which would fail if hit.
PiperOrigin-RevId: 690491467
Change-Id: Ieff4e616348254f29200e0ba1d9a6900a2eea130
Avoid creating std::vector<const T> in UnorderedElementsAreArrayMatcher and others.std::vector<const T> for trivially relocatable types is not allowed by C++ and is rejected by libc++ starting from https://github.com/llvm/llvm-project/commit/4e112e5c1c8511056030294af3264da35f95d93c
PiperOrigin-RevId: 686487841
Change-Id: I3c90c7c0a6e8e23ffa5ebd1702a3f30ebc4a702f
This change adjusts how `ASSERT_NEAR` and `EXPECT_NEAR` treats infinity, such that `ASSERT_NEAR(inf, inf, 0)` passes. This makes the behavior more consistent with `ASSERT_EQ(inf, inf)` which succeeds.Some examples of asserts that now pass:
```
ASSERT_NEAR(inf, inf, 0)
ASSERT_NEAR(-inf, inf, inf)
ASSERT_NEAR(inf, x, inf) // x is any finite floating point value
```
PiperOrigin-RevId: 685748133
Change-Id: I7b3af377773e8e0031e4c6b86830cbbf76bf20c6
Remove auto-detection of Python toolchain from MODULE.bazel since it affects downstream usersThe correct solution appears to be
https://rules-python.readthedocs.io/en/stable/toolchains.html#library-modules-with-dev-only-python-usage
This change also includes a workaround for the new mechanism creating
paths that are too long for Windows to handle.
Fixes #4581
PiperOrigin-RevId: 657706984
Change-Id: I8ae6b9e5efeb7629d79d14e7d4d3889876282d17
Directly include `gmock.h` and `gtest.h` in gmock-matchers tests.These headers have been included through `gmock-matchers_test.h`
PiperOrigin-RevId: 657612455
Change-Id: I65675f1cfe7789f1821ccacbe60acf90efd5c221
gmock-actions: make DoAll convert to OnceAction via custom conversions.Currently it will refuse to become a `OnceAction` if its component sub-actions
have an `Action` conversion operator but don't know about `OnceAction` in
particular because although `Action` is convertible to `OnceAction`, the
compiler won't follow the chain of conversions.
Instead, teach it explicitly that it can always be a `OnceAction` when it can be
an `Action`.
PiperOrigin-RevId: 65539303...
Change the Bazel build to use the canonical repo names used by Bzlmod and the Bazel Central RegistryGoogleTest and its dependencies now use the following names:
GoogleTest: com_google_googletest -> googletest
Abseil: com_google_absl -> abseil-cpp
RE2: com_googlesource_code_re2 -> re2
Bazel users using the WORKSPACE file to specify dependencies may
need to use https://bazel.build/rules/lib/repo/http#http_archive-repo_mapping
to remap repositories to their former names if their dependencies do...
Fix the documentation that erroneously says you can use short versions of help flagsFixes #4564
PiperOrigin-RevId: 650730047
Change-Id: I3a52aca490338066c607e34ab20c827bfde5090d
Add a bounds check to protect against an empty vector from GetArgs(), which can cause an out of bounds access in GetCurrentExecutableName(). One way this can happen is if the user forgets to call InitGoogleTest().PiperOrigin-RevId: 647740658
Change-Id: Id87692aa3d515b8ae0836e474be477d2aafa3871
Skip the predicate on SIGSEGV in death-test on Android builds with API level <= 21.PiperOrigin-RevId: 643076477
Change-Id: Id9486b7d73c3b17851df1eaf8f5ab2085238bf75
Update GoogleTest CI Docker image to use Clang 19, GCC 14, and CMake 3.29.3PiperOrigin-RevId: 636977286
Change-Id: Id9e09398a991c74c2137672948a1eb7dd2d96596
Change GoogleTest flag removal to not read beyond the end of the array to the NULL terminator. #4532 says ASAN complains about this on some platforms, although it is not clear if ASAN or the platform implementation is incorrect about accessing the terminating NULL.Fixes #4532
PiperOrigin-RevId: 635886009
Change-Id: Ibb4237055488c895b1dd09145ab979347bb9a390