gMock Cookbook: Fix incorrect comment about EXPECT priority order
It's actually the last matching expectation that's used, not the first.
PiperOrigin-RevId: 316490770
Detection of string_view type (whether it's std or Abseil)
is done in googletest/include/gtest/internal/gtest-port.h
with GTEST_INTERNAL_HAS_STRING_VIEW.
Make visible ParseInt32 in case users have separate gmock/gtest libraries and hidden-by-default symbols.
This function is still considered an internal implementation detail and is subject to change without notice. It is still unsafe/unsupported to link together libraries built at different commits.
PiperOrigin-RevId: 315405429
Fail TEST_Ps or TYPED_TEST_Ps that are defined but are not instantiated, as well as the opposite case, where INSTANTIATE_TEST_SUITE_P or INSTANTIATE_TYPED_TEST_SUITE_P is used but without any matching TEST_P or TYPED_TEST_P.
PiperOrigin-RevId: 315255779
Adds support for printing the types char8_t, char16_t, and char32_t
This changes prints these types as Unicode code points. It is possible
that there is a better way of printing these types, but that change is
more complex, and the format in which Googletest prints these types is
subject to change if someone implements a better way of printing them.
This fixes the C++20 build, which removed support for printing these types.
https://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2Fixes#2854
PiperOrigin-RevId: 314826912
gMock Cookbook: Slight rewording
Remove "I" because documentation can have multiple authors. And remove unnecessary "guy".
PiperOrigin-RevId: 314533746
Note that EXPECT_EQ(actual_value, expected_value) or EXPECT_THAT(actual_value, Eq(expected_value)) is preferred over EXPECT_THAT(actual_value, expected_value).
PiperOrigin-RevId: 314350852
Silence MSVC C4100 (unused formal parameter) to fix breakage from recently added testcase. This warning is silenced in many files throughout googletest, but was not needed here until this testcase was added.
PiperOrigin-RevId: 312121200
Mark ACTION_Pn()-generated functions as must-use-result.
This catches when a client creates an action and discards it, thinking that the action has actually been applied to something.
This will help people who make the mistake of defining, for example, both `void Use(Foo*)` and `ACTION(Use) { Use(arg); }` for later application to a Foo. With such an overload, a client may then write `Use();`, forgetting the param and being confused why nothing happens.
This also catches when a client defines their own action in terms of an ACTION()-generated one, invokes the ACTION's builder, and then fails to invoke the resulting action, thinking it's operating on the outer action's parameters.
PiperOrigin-RevId: 312108101
Fix the ACTION* macros to allow for more than 10 arguments in the action.
Only the first 10 will be passed as individual arguments as `argN`, but the rest
can be accessed from the `args` tuple.
PiperOrigin-RevId: 311542098
Fixed#2823 - Make it so that a semicolon appearing after an invocation of GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_ does not trigger a redundant semicolon warning.
This works by introducing an else block with a statement that intentionally does not end with a semicolon, forcing users to place the semicolon after the expansion. The approach here is preferred as opposed to removing semicolons that appear after each invocation because complete statements that do not have a visible semicolon or braces confuse users and code formatters, since the macro invocation looks superficially like an expression.
PiperOrigin-RevId: 311327491
The documentation for IsDebuggerPresent says that one just should
include windows.h, as that one is an umbrella header that includes
the header that declares IsDebuggerPresent. In older Windows SDKs,
debugapi.h didn't exist and IsDebuggerPresent was declared in
winbase.h (also included by windows.h).
This should fix issue #2822 properly.
This reverts commit a9f6c1ed1401dd9b002d4c43fb9f946d2c7466d0.
That commit cannot fix the issue it sets out to fix.
The original issue, #2822, was that building with a toolset
targeting XP compatibility is missing the debugapi.h header -
as debugapi.h didn't exist in older Windows SDKs.
Commit a9f6c1ed1401dd9b002d4c43fb9f946d2c7466d0 misinterpreted
the Microsoft documentation about IsDebuggerPresent. The information
about which header to use, "debugapi.h (include Windows.h)" means
that the function declaration currently lives in debugapi.h, but
for compatibility, just include the Windows.h umbrella header.
In older Windows SDKs (e.g. the v6.0a SDK), IsDebuggerPresent
is declared in winbase.h, and debugapi.h doesn't exist at all in those
versions.
Including Windows.h with a different capitalization than the existing
include won't help finding headers that don't exist.
Including Windows.h with a capital W breaks cross compilation with mingw
toolchains, where the header always has been spelled with a lower case
W. When building on native windows, the file system is case insensitive
and the capitalization doesn't matter.
This fixes issue #2840.
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