1039 Commits

Author SHA1 Message Date
Abseil Team
d144031940 Fixing a typo in the documentation of IsSubsetOf().
PiperOrigin-RevId: 692957797
Change-Id: Ifd3efe64cd2a3a5623167fa13de61d6e3358662d
2024-11-04 07:26:27 -08:00
Abseil Team
df1544bcee 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 4e112e5c1c
PiperOrigin-RevId: 686487841
Change-Id: I3c90c7c0a6e8e23ffa5ebd1702a3f30ebc4a702f
2024-10-16 06:39:54 -07:00
Abseil Team
71815bbf7d Automated Code Change
PiperOrigin-RevId: 682549952
Change-Id: Ica81f0020c3001c01543a5851dae7d0b42730c66
2024-10-04 20:54:14 -07:00
Abseil Team
a1e255a582 Optional(): Add support for std::optional<>-like types lacking bool conversion.
PiperOrigin-RevId: 681053268
Change-Id: If80ba667fd4c91340e1405a9691f5ca0350fa9eb
2024-10-01 09:35:17 -07:00
Abseil Team
6dae7eb4a5 Use matcher's description in AnyOf when matcher has no explanation.
PiperOrigin-RevId: 675298308
Change-Id: I32d32cafebc7a63fd03e6d957c3a47043d71e5d9
2024-09-16 14:49:27 -07:00
Abseil Team
0953a17a42 Automated Code Change
PiperOrigin-RevId: 668944316
Change-Id: I65aa0a4f3b8a980242849963a3e921ec7fd92b28
2024-08-29 08:17:22 -07:00
Abseil Team
ffa31aec1c 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
2024-07-30 09:03:18 -07:00
Abseil Team
5bcb2d78a1 Use matcher's description in AllOf if matcher has no explanation.
PiperOrigin-RevId: 655569834
Change-Id: Ia760d74d1cdde766e9719864c5e19c0159da3128
2024-07-24 08:07:57 -07:00
Aaron Jacobs
352788321f 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: 655393035
Change-Id: Ib205b518ceef5f256627f4b02cd93ec9bd98343b
2024-07-23 19:43:42 -07:00
Aaron Jacobs
57e107a10e Run clang-format.
PiperOrigin-RevId: 655106304
Change-Id: Ie69b407fce74b31cf71d6dcc1361910d30e86bb5
2024-07-23 03:57:23 -07:00
Abseil Team
d49a665484 Use matcher's description in AllOf if matcher has no explanation.
PiperOrigin-RevId: 652798234
Change-Id: I8e92248a2d9faf2a5719fe220145ea563acc14ff
2024-07-16 05:22:42 -07:00
Abseil Team
417158b8bc Use matcher's description in AllOf if matcher has no explanation.
PiperOrigin-RevId: 652634229
Change-Id: I5fd7eaef4db3dea3d4142e1fb5fc97e46f654358
2024-07-15 16:40:10 -07:00
Abseil Team
c8393f8554 Print mismatches for UnorderedElements() of different sizes.
Changes the behavior of UnorderedElements()/UnorderedElementsAreArray() to print items-without-matchers and matchers-without-items in the case where the actual and expected are different sizes.

PiperOrigin-RevId: 635451316
Change-Id: I2181bb28a14c14cdb577af9268d403e12e942bea
2024-05-20 07:36:47 -07:00
Abseil Team
2d684efe87 Use std::forward on GoogleTest matcher arguments
This prevents a diagnostic from triggering for a missing std::move.

PiperOrigin-RevId: 631094640
Change-Id: I4ab33964c65f41240fb54a6bf7d0261836fd78e7
2024-05-06 09:48:55 -07:00
Derek Mauro
5a37b517ad Use [[maybe_unused]] when it is available to avoid
-Wused-but-marked-unused warnings

PiperOrigin-RevId: 625430612
Change-Id: Ia9d2e47984e1e6f91966afae8a6750119ae69446
2024-04-16 13:16:40 -07:00
Lawrence Wolf-Sonkin
0af976647f [gtest] Use std::index_sequence and friends instead of rolling our own
* Applies for `std::index_sequence`, `std::make_index_sequence`, and `std::index_sequence_for` replacing `IndexSequence`, `MakeIndexSequence` and IndexSequenceFor`
* Also deleted implementation helper `DoubleSequence`
* The standard interfaces [have been in the standard library since C++14](https://en.cppreference.com/w/cpp/utility/integer_sequence), which [is the minimum supported C++ version by Google Test](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)

PiperOrigin-RevId: 621939977
Change-Id: Id264266f08da66c0fa2a6e6fbb8f86fd3cb3a421
2024-04-04 12:38:42 -07:00
Abseil Team
c231e6f5b1 Add test for move-only type in Action signature
PiperOrigin-RevId: 616031018
Change-Id: Ie724f9562174387eab866a824d28106f344c558d
2024-03-15 00:00:12 -07:00
Daniel Cheng
b479e7a3c1 Guard Abseil flags usage in googlemock with GTEST_NO_ABSL_FLAGS.
googletest avoids using the Abseil flag library, so googlemock should
do the same for consistency.

PiperOrigin-RevId: 614713968
Change-Id: I0925804b8644ddc6fd3ad07a320d94829b11bb8e
2024-03-11 10:31:56 -07:00
Copybara-Service
926f681a90 Merge pull request #4466 from danfabo:fix-fetch-content-uses-gtest
PiperOrigin-RevId: 612560830
Change-Id: Ib639603d34258909cf0e0d6fceb297dd8c983d54
2024-03-04 13:15:25 -08:00
Abseil Team
e4fdb87e76 Accept one-shot callables in InvokeArgument.
PiperOrigin-RevId: 611467660
Change-Id: Ic89ffc986141bee61f835cb60088aee92eb8bad9
2024-02-29 07:42:26 -08:00
danfabo
f5448b3d71 Get include dirs from target rather than global variables.
The global variable gtest_SOURCE_DIR is replaced by CMake when fetch-content is used with the name "GTest" and points to the root directory. The include directories from the gtest target are always valid.
2024-02-11 18:50:28 +01:00
Matt Kulukundis
b75ecf1bed Switch rank structs to be consistent with written guidance in go/ranked-overloads
PiperOrigin-RevId: 605110251
Change-Id: I304f3863333cb9ef0b85c5bab5277e757ef9950a
2024-02-07 15:06:10 -08:00
Abseil Team
96519a4019 Use _Exit instead of _exit in GoogleTest
_Exit is standardized since C99, whereas _exit is POSIX-only.

Fixes: #4447
PiperOrigin-RevId: 605000352
Change-Id: Ibfa84edaa043bd003a21383e8148bf45be7217f6
2024-02-07 09:01:25 -08:00
Abseil Team
dddb219c3e Accept move-only callables in InvokeArguments
PiperOrigin-RevId: 594223533
Change-Id: I491fae7d851d4e0df07fb3627416949071fec8d6
2023-12-28 04:04:00 -08:00
Abseil Team
8495449f07 Fix data race in leak detection
TSAN identified a data race between updates to the states_ map (ex. in Mock::UnregisterLocked) and the iteration done in this destructor. Writes to the map use g_gmock_mutex, but the destructor does not acquire it. Acquiring the lock here fixes the data race.

It should only be possible to trigger this TSAN finding in cases where a mock object is deleted by a thread other than the main thread.

PiperOrigin-RevId: 591935393
Change-Id: I9dd1faa40058d78e165a91333346514b4b73365c
2023-12-18 10:14:49 -08:00
Abseil Team
76bb2afb8b Implement testing::Rethrow to throw exceptions more easily via std::exception_ptr
We avoid overloading or specializing `testing::Throw` as this is fundamentally a different operation than throwing the object.
However, we disable the corresponding overload of `testing::Throw` to prevent likely mistakes in the usage.

Fixes: #4412
PiperOrigin-RevId: 585745469
Change-Id: I03bb585427ce51983d914e88f2bf65a13545c920
2023-11-27 13:32:49 -08:00
Abseil Team
5b7fd63d6d Export gmock-spec-builders.
gmock.h is the umbrella header to be used for rest of the library, and it also
enables users to export certain details. This wasn't working for some interfaces
like EXPECT_CALL because gmock-spec-builders wasn't explicitly exported.

PiperOrigin-RevId: 576966583
Change-Id: Ie050430cf11384977cd95f4ed6e73235d6857057
2023-10-26 13:15:23 -07:00
Dino Radakovic
518387203b StartsWith: Explicitly construct matcher-typed strings from matchee parameter
The current implementation breaks for absl::string_view on gcc, c++14: https://godbolt.org/z/Tzd3q1fqx

Closes #4391

PiperOrigin-RevId: 575853981
Change-Id: I7b782598add480eb69d4ca27ea4a4bf5f758f6a3
2023-10-23 10:11:36 -07:00
Dzmitry Ivaniuk
2d09ed35cf cmake: Fix comments in cmake files
Remove extra spaces. Fix so that the comment line starts with a capital letter and ends with a dot.
2023-09-29 17:26:23 +03:00
Copybara-Service
5bd0f08e0d Merge pull request #4374 from masbug:main
PiperOrigin-RevId: 568317621
Change-Id: Icf7fb519f96f5e88eb0df491eed143134c8ac6eb
2023-09-25 14:00:54 -07:00
Mitja Spes
e27b194c27 Fix compile warnings in gmock-function-mocker.h
Template type int changed to size_t.
This fixes compile warning `conversion to ‘long unsigned int’ from ‘int’ may change the sign of the result` in gmock-function-mocker.h.
2023-09-21 10:06:21 +02:00
Abseil Team
adc5145386 Update code with IWYU annotations.
PiperOrigin-RevId: 566424331
Change-Id: I0e16d979b9d79643c882c5082e154842983a5317
2023-09-18 15:04:08 -07:00
Copybara-Service
460ae98267 Merge pull request #4349 from sthd:httpToHttps
PiperOrigin-RevId: 559452348
Change-Id: I6f72001fd6b8e5a739c34121c8847c281d563b0f
2023-08-23 09:30:13 -07:00
sthd
f0eae4b399 changed http to https 2023-08-22 20:58:34 +03:00
Abseil Team
762d3a7f66 Clean up typos: Exhaused => Exhausted
PiperOrigin-RevId: 558801066
Change-Id: Ia225d12014748db87639414f4c8c28a0d0e9e489
2023-08-21 08:47:54 -07:00
Robert Shade
429432e341 Avoid unreachable code warning 2023-08-02 14:09:54 -04:00
Copybara-Service
c541e7c110 Merge pull request #4302 from ciband:feat/nrf52
PiperOrigin-RevId: 549006105
Change-Id: Ifbe2bf57e10df4c71e51dbfaf1687f4f621f5106
2023-07-18 08:16:57 -07:00
Chris Johnson
091d7eb897 add support for nrf52
Added support for Nordic nRF52 series of MCUs
2023-06-27 08:29:23 -05:00
Juan Ramos
812f35b26b cmake: Remove remaining checks for CMAKE_VERSION
Remove conditional code that doesn't need to exist anymore.
2023-06-20 19:09:04 -06:00
Copybara-Service
29836977ef Merge pull request #4288 from juan-lunarg:juan/cmake_min_3_dot_6
PiperOrigin-RevId: 541929012
Change-Id: I90423820611c2b6a6f81fe3f9ec2d23992ffbed1
2023-06-20 08:20:43 -07:00
Juan Ramos
4fed5f2850 cmake: Raise min to 3.6
From the CMake 3.27 release notes:
Compatibility with versions of CMake older than 3.5 is now
deprecated and will be removed from a future version. Calls to
cmake_minimum_required() or cmake_policy() that set the policy
version to an older value now issue a deprecation diagnostic.

This PR also removes manually setting policy CMP0048. This is
redundant since the CMake min is already 3.X
2023-06-19 11:21:44 -06:00
Copybara-Service
a3580180d1 Merge pull request #4146 from lygstate:fixes_std_pair_diff
PiperOrigin-RevId: 528781910
Change-Id: I4038332a6255921792bfb4a8098aa84243d48e15
2023-05-02 07:52:02 -07:00
Andy Soffer
76bce79a34
Merge branch 'main' into fixes_std_pair_diff 2023-05-01 14:27:38 -04:00
Dino Radakovic
797b0ad2a3 Use GTEST_INTERNAL_CPLUSPLUS_LANG instead of __cplusplus
Some versions of MSVC provide incorrect values for the latter and rely on _MSVC_LANG instead.
Fixes #4226.

PiperOrigin-RevId: 527919195
Change-Id: Ifcca4612074f5ebc5337094426866a187f79f90a
2023-04-28 10:16:07 -07:00
Tom Hughes
0bdaac5a14 Add qualifier to avoid argument dependent lookup
PiperOrigin-RevId: 527740306
Change-Id: I61308cc232c346d5ff8b0548d4c552a59633fffc
2023-04-27 18:17:59 -07:00
Patryk Gawroński
51eeae5a55 gmock: fix issue #4222
Rename 'Result' struct to 'NonMoveableStruct' in
gmock-spec-builders_test.cc in ExpectCallTest.NonMoveableType test
2023-04-25 01:45:26 +02:00
Tom Hughes
783d00fd19 Use '=default' to define trivial constructor/destructors
https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html

PiperOrigin-RevId: 526079054
Change-Id: Ia4db21e3e5f58b90de05d52fd94b291ed06d785d
2023-04-21 10:41:25 -07:00
Tom Hughes
baf182e006 Use the empty method to check for emptiness
PiperOrigin-RevId: 526046714
Change-Id: I6ad0deff2a7f6dfef75a643c95ad914c83b9ba38
2023-04-21 08:42:42 -07:00
Tom Hughes
a5308bb992 Add missing std includes
PiperOrigin-RevId: 525850646
Change-Id: I64387f5b933beb79cd05636dca81b7a75213383e
2023-04-20 14:29:09 -07:00
Copybara-Service
d25e625364 Merge pull request #4219 from jerylvaz:main
PiperOrigin-RevId: 524932412
Change-Id: Ie70282f7e82cb3b9442bd15bbe49bb9b00e56eb9
2023-04-17 13:23:38 -07:00