Mention matchers as an alternative to assertions in subroutines.
Matchers are often the better choice - they can provide more informative error messages and circumvent all of the complexity described in this section.
PiperOrigin-RevId: 326332149
Updated documentation for Value-Parameterized Tests: Per-default, a TEST_P without a corresponding INSTANTIATE_TEST_SUITE_P now causes a failing test.
PiperOrigin-RevId: 323622468
Fix `-Wgnu-zero-variadic-macro-arguments` in GMock
Passing zero arguments to the variadic part of a macro is a GNU
extension and triggers warnings when build projects using GMock with
`-pedantic`.
- Fix uses of `GMOCK_PP_INTERNAL_16TH` to always receive at least 17
arguments. (this was triggered when `GMOCK_PP_NARG` or `GMOCK_PP_HAS_COMMA`
were used with an argument containing no commas).
- Fix `GMOCK_PP_HEAD` to append a dummy unused argument so that
`GMOCK_PP_INTERNAL_HEAD` always has two arguments.
PiperOrigin-RevId: 310414611
Add --gtest_fail_fast support to googletest.
- Analogous functionality to to golang -test.failfast and python --failfast
- Stops test execution upon first test failure.
- Also add support Bazel equivalent env var (TESTBRIDGE_TEST_RUNNER_FAIL_FAST)
PiperOrigin-RevId: 302488880
Add GTEST_ALLOW_UNINSTANTIATED_PARAMTERIZED_TEST to mark a paramaterized test as allowed to be un-instantiated.
This allows test suites, that are defined in libraries and, for other reasons, get linked in (which should probably be avoided, but isn't always possible) to be marked as allowed to go uninstantiated.
This can also be used to grandfather existing issues and expedite adoption of the checks with regards to new cases before they can be fixed.
PiperOrigin-RevId: 289581573
Split the scoped trace examples into two snippets.
This doesn't have an effect in the github markdown renderer, but in some other renderers/templates, this leads them to be independently copy-pastable. In particular, the markdown rendering that Google uses internally has a copy button for each code snippet, which, before this change, would copy both lines. Bad copy button, no cookie! After this change, there will be two such buttons, one per line, and clicking a copy button will copy only the one snippet it is next to, and not the other. This is desirable because nobody will ever want to copy both lines, only one or the other.
PiperOrigin-RevId: 276079009
Merge 3bdefdb473d304803d2a38e2a2cd5cdc1827c3bd into fb49e6c164Closes#2407
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/googletest/pull/2407 from kuzkry:StaticAssertTypeEq 3bdefdb473d304803d2a38e2a2cd5cdc1827c3bd
PiperOrigin-RevId: 269255328
gtest prior to this change would completely ignore `GTEST_SKIP()` if
called in `Environment::SetUp()`, instead of bailing out early, unlike
`Test::SetUp()`, which would cause the tests themselves to be skipped.
The only way (prior to this change) to skip the tests would be to
trigger a fatal error via `GTEST_FAIL()`.
Desirable behavior, in this case, when dealing with
`Environment::SetUp()` is to check for prerequisites on a system
(example, kernel supports a particular featureset, e.g., capsicum), and
skip the tests. The alternatives prior to this change would be
undesirable:
- Failing sends the wrong message to the test user, as the result of the
tests is indeterminate, not failed.
- Having to add per-test class abstractions that override `SetUp()` to
test for the capsicum feature set, then skip all of the tests in their
respective SetUp fixtures, would be a lot of human and computational
work; checking for the feature would need to be done for all of the
tests, instead of once for all of the tests.
For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`,
by not executing the testcases, is the most desirable solution.
In order to properly diagnose what happened when running the tests if
they are skipped, print out the diagnostics in an ad hoc manner.
Update the documentation to note this change and integrate a new test,
gtest_skip_in_environment_setup_test, into the test suite.
This change addresses #2189.
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>