Standardize access to GoogleTest flags on GTEST_FLAG_GET/GTEST_FLAG_SET
Custom implementations can decide how access to flags is performed depending on the implementation of flags being used.
PiperOrigin-RevId: 388181424
Add `Conditional` wrapper to gtest
This follows an initial proposal for an 'EqIff` matcher. `Conditional` was considered more precise as an EqIff() matcher may suffer from `Iff` not being universally understood.
PiperOrigin-RevId: 383407665
gtest: Add a flag to only set up/tear down test environments once when repeating
Currently when running a test multiple times using `--gtest_repeat` the global
test environment(s) are set up and torn down for each iteration of the test.
When checking for flakes in tests that have expensive dependencies that are set
up in the test environment (subprocesses, external dependencies, etc) this can
become expensive.
To support finding flakes in tests that fit into this category, where the setup
phase is expensive but each test case is fast, allow callers to specify via
`--gtest_recreate_environments_when_repeating=false` that the test environments
should only be set up once, for the first iteration, and only torn down once, on
the last iteration. This makes running a test with `--gtest_repeat=1000` a much
faster and more pleasant experience.
PiperOrigin-RevId: 382748942
The documentation is clear that the FOO we'll be guarding always matches
the spelling of the DONT macro. A single guard macro should not toggle
more than one implementation macro.
This fixes a regression in 7413280c52c1f759395572a384165023d24eeb57.
Relatedly, improve the documentation of the DONT macros to bring the
list of valid FOO values up to date.
Implement 'Contains(e).Times(n)' matcher modifier which allows to test for arbitrary occurrences including absence with Times(0).
PiperOrigin-RevId: 382210276
Make multiple attempts to verify GetThreadCount()
Testing GetThreadCount() is inheritently noisy, as other threads can be started
or destroyed between two calls to GetThreadCount(). This is especially true
under certain analyzer configurations, such as TSAN.
PiperOrigin-RevId: 381951799
EXPECT_DEATH() and ASSERT_DEATH() have a switch case where every
possible case is covered. This makes the default case unnecessary
and triggers -Wcovered-switch-default.
Due to these being macros, the lines are expanded in user code and
are thus subject to warnings of the target codebase.
Fixes#3456
Remove -Werror from the CMake compiler flags
We should not force warnings as errors on users.
Sometimes compilers introduce new warnings which
will break builds.
Instead, we manually turn this flag on in our continuous integration
scripts so we can catch these errors, but not force them on our users.
Fixes#3447
PiperOrigin-RevId: 380241852
Fix MSVC warning C4275: non dll-interface class
'testing::MatcherDescriberInterface' used as base for dll-interface
class 'testing::internal::MatcherBase<std::string>'
Fixes#3415
PiperOrigin-RevId: 377352684
This was causing the following linker error on Microsoft Visual C++ when compiling as a DLL:
```
googletest-param-test-test.cc.obj : error LNK2019: unresolved external symbol "public: __cdecl testing::internal::MarkAsIgnored::MarkAsIgnored(char const *)" (??0MarkAsIgnored@internal@testing@@QEAA@PEBD@Z) referenced in function "void __cdecl works_here::`dynamic initializer for 'gtest_allow_ignore_NotInstantiatedTest''(void)" (??__Egtest_allow_ignore_NotInstantiatedTest@works_here@@YAXXZ)
```