Actions can now be implicitly constructed from zero-argument callables. There is no need to create wrapper objects using InvokeWithoutArgs().
PiperOrigin-RevId: 949656497
Change-Id: Ida2bc38e446e7b33aaf185ec593caf2a1959138e
The fallback check GTEST_INTERNAL_HAS_INCLUDE(<compare>) && C++20 causes build failures on Android NDK 24 which has the header but lacks the full comparison operators needed by PrintTo. The feature test macro __cpp_lib_three_way_comparison is the reliable indicator.
Fixes#4933
Since we can't directly depend on proto headers, we rely on ADL + proto headers being included by calling code for this matcher to choose the right overload of `DynamicCastMessage`.
PiperOrigin-RevId: 940593408
Change-Id: I7374aed3c5cfe61a183d28ea02e6583ab340f647
PR https://github.com/google/googletest/pull/3940 added COMPILE_PDB_OUTPUT_DIRECTORY
without updating the install command to accommodate the two PDB properties.
COMPILE_PDB_* and PDB_* properties are two distinct properties that affect static
(COMPILE_PDB_*) and shared (PDB_*) separately.
This commit adds cmake install rule for both types (optionally) to install when available
Protobuf messages have a custom dynamic_cast, for when RTTI is not available on the messages.
PiperOrigin-RevId: 933270097
Change-Id: Iaeb50bce3fe1b746306a7507ab1985b111c03416
In particular this automatically gives us support for examples like the
following:
using SomeFn = absl::AnyInvocable<R(Args...) const>;
MockFunction<SomeFn> some_fn;
PiperOrigin-RevId: 921303527
Change-Id: I19bf59671781e85db65cc20c0d6ea10b056c528a
Subsequences are defined as: "a subsequence of a given sequence is a sequence that can be derived from the given sequence by deleting some or no elements without changing the order of the remaining elements."
See: https://en.wikipedia.org/wiki/Subsequence
This new matcher checks if a container contains elements that match a given sequence of matchers in the specified order, but not necessarily contiguously.
The implementation is very similar to other matchers like ElementsAre or Contains.
PiperOrigin-RevId: 918323422
Change-Id: I56d7ebbe6f81038c93546ef7585db59eea5dbd57
This uses the environment variables as the default value for the command line argument, so this is not a breaking change to most reasonable existing use cases. This *is* a breaking change if a process expects changes to the sharding environment variables to be visible after parsing the command line arguments.
The motivation for this is that some environments do not support environment variables, which prevents the usage of test sharding. These environments also run on simulators and other slow hardware, where sharding is especially important. I've tried a few other things, like hacking together a fake implementation of `getenv`/`setenv`, but this is a pretty unreliable approach on the platform in question.
This also seems like an improvement in consistency to me. Currently, other test selection mechanisms (e.g. filtering, shuffling, repeat), `use arguments (or at least have command line arguments as an option), while as far as I can tell, sharding is the only mechanism which can *only* be specified with environment variables.
PiperOrigin-RevId: 892324928
Change-Id: I5cf814e46e16072e7c160e54c426b02300fe712b
DieInCRTDebugElse12() is only used inside a #ifdef _DEBUG block. Put
its definition inside a #ifdef _DEBUG block, too, otherwise we get a
"defined but not used [-Wunused-function]" warning under MinGW GCC.
PiperOrigin-RevId: 891795658
Change-Id: Ic9109eebc354dd20b2a5430794f491c9b451931f
Add an alternative implementation of the Notification class for MinGW
using a Windows manual-reset event object.
GCC version < 13 in MinGW, if configured with the win32 thread model
(with the --enable-threads=win32 configure option), does not implement
std::mutex and std::condition_variable in the <mutex> and
<condition_variable> headers. So the current implementation of the
Notification class, which uses std::mutex and std::condition_variable,
has compilation errors. Windows has a synchronization object called a
manual-reset event object that behaves just like the Notification class.
So we can easily implement the Notification class using a Windows
manual-reset event object.
This GCC issue is fixed in GCC 13. See
https://gcc.gnu.org/gcc-13/changes.html#windows. This alternative
implementation of Notification should be removed when GoogleTest
requires GCC version >= 13 in MinGW.
Fixes https://github.com/google/googletest/issues/4031 and
https://github.com/google/googletest/issues/4464.
PiperOrigin-RevId: 888752598
Change-Id: I69e01b2e7953e1fe72d87b6d0804c7a8a8d0e740
This is needed for ranges such as [`std::ranges::subrange`](https://en.cppreference.com/w/cpp/ranges/subrange.html) that don't expose the typical typedefs.
PiperOrigin-RevId: 879124865
Change-Id: Ie89e6ff249ee861d1b2d880079dc162bb9801679
Update str concatenation, instead of use operation+ use absl::StrCat
whenever available.
PiperOrigin-RevId: 874649732
Change-Id: I0acd91c04a9e50fa306e7130479bc330c1a0f068
If the iterators are forward iterators, we can measure the size and reserve the vector, avoiding reallocations and copying.
PiperOrigin-RevId: 874172640
Change-Id: Ie081fdf7952858d7e41ddda63a3ae15d9867c8c5
If the iterators are forward iterators, we can measure the size and reserve the vector, avoiding reallocations and copying.
PiperOrigin-RevId: 874129590
Change-Id: I6cdcaf38e28ac90c1cf596977b703d8de93994e5
Change a mention of Eq(Optional(nullopt)) to Optional(Eq(nullopt)).
Optional is supposed to wrap matchers, not values. For example, Optional("bla") doesn't compile but Optional(std::string("bla")) does. Optional(Eq("bla")) is the functionally correct version. Eq() cannot wrap a matcher.
PiperOrigin-RevId: 872885639
Change-Id: I941f515308fa419162998073f6da9731fcf2168a
Clarify that SizeIs only requires the container to have a size() method, and the argument type can be any type compatible with the return type of size(). The previous comment incorrectly mentioned a requirement for size_type.
PiperOrigin-RevId: 869184176
Change-Id: Ib2d867fbfecde0006734772cf07958871a171199
Keep one build on 8.5.1 to test WORKSPACE
Fixes the -Wdeprecated-declaration warnings
enabled by default in Bazel 9 that come from the
single-arg Invoke().
Fixes the new -Winconsistent-missing-override that
we intentionally use in a test.
Upgrades RE2 to a version compatible with Bazel 9.
PiperOrigin-RevId: 865966282
Change-Id: I5f7c3b60daf5f8a90be08004d96aaa59611e35c4