summaryrefslogtreecommitdiffstats
path: root/googlemock
Commit message (Collapse)AuthorAgeFilesLines
* gmock_output_test: normalize golden file output to unix line endingsAbseil Team2023-01-171-0/+3
| | | | | | | | When checked out on Windows, the repo might use \r\n line endings, and so the golden output has them. Adjust for that. PiperOrigin-RevId: 502577222 Change-Id: Iabfe537f6d95a49bf6bdcb934e855d28c65f6f89
* Fix -Wshadow warningsTom Hughes2023-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | ../googlemock/test/gmock-actions_test.cc:687:36: warning: declaration of ‘v’ shadows a member of ‘testing::{anonymous}::ReturnTest_SupportsReferenceLikeReturnType_Test::TestBody()::Result’ [-Wshadow] 687 | Result(const std::vector<int>& v) : v(&v) {} // NOLINT | ~~~~~~~~~~~~~~~~~~~~~~~~^ ../googlemock/test/gmock-actions_test.cc:686:29: note: shadowed declaration is here 686 | const std::vector<int>* v; | ^ ../googlemock/test/gmock-actions_test.cc: In constructor ‘testing::{anonymous}::ReturnTest_PrefersConversionOperator_Test::TestBody()::Out::Out(int)’: ../googlemock/test/gmock-actions_test.cc:720:28: warning: declaration of ‘x’ shadows a member of ‘testing::{anonymous}::ReturnTest_PrefersConversionOperator_Test::TestBody()::Out’ [-Wshadow] 720 | explicit Out(const int x) : x(x) {} | ~~~~~~~~~~^ ../googlemock/test/gmock-actions_test.cc:718:9: note: shadowed declaration is here 718 | int x; | ^ PiperOrigin-RevId: 501580618 Change-Id: I584710fbbe440ec724f88746e51f3be5653c32d5
* IWYU: Add missing std includesTom Hughes2023-01-052-0/+2
| | | | | PiperOrigin-RevId: 499893032 Change-Id: I33304802b7c82ae2d008f3ee89df38866e5f57ba
* Shut up a Clang warning.Abseil Team2022-12-151-1/+6
| | | | | | | | | | | | | | | Clang warns on this pattern because it looks like the author might have meant to use the value of the first part of the comma operator, so it warns that it isn't being used. The cast here signals to Clang that this behavior is intentional. This was discovered while updating gmock in Android. Clang's -Wcomma warning is on by default with either -Wall or -Werror, so users of gmock with those on in combination with -Werror are unable to build without this fix. PiperOrigin-RevId: 495655990 Change-Id: Iaf27e2199669f5b6185a877738234e551b6b6556
* Refactor matrix verification into VerifyMatchMatrix.refs/pull/4082/headAbseil Team2022-12-122-17/+17
| | | | | PiperOrigin-RevId: 494786543 Change-Id: I7769558dd2ca046d8957bf352dc04cfb48ff7c3a
* Make SizeIsMatcher::Impl conform to the contract of MatcherDescriberInterface.Abseil Team2022-11-302-4/+4
| | | | | | | MatcherDescriberInterface specifies that DescribeTo "should print a verb phrase", but "size ..." is not a verb phrase. Currently, ElementsAre(SizeIs(9)) is described as "has 1 element that size is equal to 9". With this change, it will be described as "has 1 element that has a size that is equal to 9". PiperOrigin-RevId: 492022324 Change-Id: I4083335f2419462464957521c1e033643b53b763
* Disables `-Wunused-member-function` and `-Wused-but-marked-unused` that ↵Abseil Team2022-11-295-3/+59
| | | | | | | | trigger via `MOCK_METHOD()` and `EXPECT_THAT()` macros. Fixes: #4052, #4055 PiperOrigin-RevId: 491647393 Change-Id: I8e2ad838156fa8c7e9dccd1740af797e694992b6
* Remove incorrect GTEST_ATTRIBUTE_UNUSED_ from InSequence class.Abseil Team2022-11-081-1/+1
| | | | | | Fixes: #4048 PiperOrigin-RevId: 486951561 Change-Id: I4fae101b5ac5ed4f46c32aba8c36519e1f784db1
* Merge pull request #4041 from zloylos:allow-naming-expectationsCopybara-Service2022-10-253-11/+48
|\ | | | | | | | | PiperOrigin-RevId: 483683590 Change-Id: Id22de3a22018324e5c1e21e262ac5e027a83bf3e
| * Fix format without expectation namerefs/pull/4041/headDenis Hananein2022-10-211-2/+2
| | | | | | | | Signed-off-by: Denis Hananein <i@zloylos.me>
| * Change messagesDenis Hananein2022-10-212-10/+9
| | | | | | | | Signed-off-by: Denis Hananein <i@zloylos.me>
| * Allow naming expectations #3970Denis Hananein2022-10-202-4/+29
|/ | | | Signed-off-by: Denis Hananein <i@zloylos.me>
* Workaround for Visual C++ error C2039 with std::tuple_element_t.Abseil Team2022-10-122-4/+15
| | | | | | | Fixes #3931 PiperOrigin-RevId: 480659507 Change-Id: I6fabef63b1285189a06375227273d9de2456e37a
* Port GoogleTest to QuRT (Hexagon RTOS)refs/pull/4016/headMarat Dukhan2022-09-261-0/+7
|
* Remove obsolete MSVC warning pragmas for Invalid<T>()Abseil Team2022-09-081-11/+0
| | | | | | | | Remove the MSVC pragmas for disabling warning C4717 (infinite recursion) for Invalid<T>() because that warning has been fixed in cl/441474979. PiperOrigin-RevId: 473012585 Change-Id: I5f1bf88379bd4f2bf005e029c04766ac4caadd84
* Fixed header guards to match style guide conventions.Abseil Team2022-09-011-3/+3
| | | | | PiperOrigin-RevId: 471524660 Change-Id: Ie11e6a7a5a5497f64d5b9c382f1017094e043093
* Merge pull request #3916 from asmodai27:mainCopybara-Service2022-08-301-3/+4
|\ | | | | | | | | PiperOrigin-RevId: 471062949 Change-Id: I3f063c441b3d4275d931016c431519c14e68d51c
| * Avoid implicit conversion from int to charJérôme Travert2022-06-261-1/+1
| |
* | Add support of 19-member structs to gmock UnpackStructImpl.Hardik Vala2022-08-222-0/+10
| | | | | | | | | | PiperOrigin-RevId: 469171380 Change-Id: Ic75fc0523924e40e620552d4c04b79dad22a68e0
* | Merge pull request #3918 from assafpr:master2mainCopybara-Service2022-08-015-8/+8
|\ \ | | | | | | | | | | | | PiperOrigin-RevId: 464586117 Change-Id: Icda62f13b962f7408bb5698ae2b627391257d152
| * | Update gmock-matchers.hassafpr2022-06-271-1/+1
| | | | | | | | | branch master changed to main on link
| * | Update gmock-actions.hassafpr2022-06-271-1/+1
| | | | | | | | | master branch changed to main in links
| * | Update gmock-spec-builders_test.ccassafpr2022-06-271-1/+1
| | | | | | | | | master branch changed to main in link
| * | Update gmock-spec-builders.ccassafpr2022-06-271-1/+1
| | |
| * | Update gmock_output_test_golden.txtassafpr2022-06-221-4/+4
| |/
* | Add support of 18-member structs to gmock UnpackStructImpl.refs/pull/3966/headAbseil Team2022-07-292-2/+17
| | | | | | | | | | PiperOrigin-RevId: 463961734 Change-Id: Ib62e320a745c190955f181c1f4f12e4cd407ef22
* | Add IsEmpty overload for C-style stringsDino Radakovic2022-07-252-7/+64
| | | | | | | | | | | | | | Fixes #3937 PiperOrigin-RevId: 463180144 Change-Id: I21b528acc4c3f3aba4234642be01fcead7fe7f00
* | Merge pull request #3927 from yutotnh:fix-typoCopybara-Service2022-07-183-4/+4
|\ \ | | | | | | | | | | | | PiperOrigin-RevId: 461699509 Change-Id: I9bab4474c5f52d4d66691dfb96a4d20f89fbcfeb
| * | fix: typo in test nameyutotnh2022-07-011-1/+1
| | |
| * | fix: some typos in commentyutotnh2022-07-012-3/+3
| | |
* | | Merge pull request #3928 from venik:venik-clean-upCopybara-Service2022-07-121-1/+1
|\ \ \ | |/ / |/| | | | | | | | PiperOrigin-RevId: 460455562 Change-Id: I29efc09887651d8734586703fe0691482ba4c981
| * | cleanup from unique_ptr branchrefs/pull/3928/headAlexander Nikforov2022-07-011-2/+1
|/ /
* | Add support of 17-member structs to gmock UnpackStructImpl.Abseil Team2022-06-291-0/+5
| | | | | | | | | | PiperOrigin-RevId: 458018249 Change-Id: I7df8f75ef5b5a6478e7301f959c221810ff9f0b3
* | Mark internal-only function as having internal linkage.Abseil Team2022-06-271-1/+1
|/ | | | | PiperOrigin-RevId: 457550818 Change-Id: I9046801b64ce4581d742d650451332fd56489632
* Work around a maybe-uninitialized warning under GCC 12Derek Mauro2022-06-013-20/+41
| | | | | | | | | | | Some Mock constructors insert the pointer to the Mock itself into a global registry. Since GCC cannot see how the pointer is used (only as an identifier), it cannot tell that the object doesn't need to be initialized at that point at all. Work around this by using uintptr_t instead. PiperOrigin-RevId: 452380347 Change-Id: Ia5a493057ed90719de1d0efab71de9a8a08ddf8b
* gmock-spec-builders: remove the name for an unused parameter.Aaron Jacobs2022-05-301-7/+1
| | | | | | | | | | | This fixes unused parameter errors under both MSVC and clang (when `-Werror=unused-parameter` is used, as reported [here](https://github.com/google/googletest/commit/9d21db9e0a60a1ea61ec19331c9bc0dd33e907b1#r74769946)). Fixes #3858 PiperOrigin-RevId: 451907906 Change-Id: Ic07da19ea6a547eb1797fbbab19cd57cc2a83fe8
* gmock-spec-builders: add support for non-moveable types.Aaron Jacobs2022-05-272-242/+158
| | | | | | | | | Do this by ripping out the "untyped perform action" machinery, which isn't necessary: we can simply template the entry point on the result type, and use RAII to avoid the need to special case void. This makes it easier to understand the code and harder to introduce type-related undefined behavior, to boot. PiperOrigin-RevId: 451493451 Change-Id: I225305f83164752ca92f2916721972eafba33168
* gmock-actions: properly support non-moveable results in `is_callable_r`.Aaron Jacobs2022-05-272-4/+79
| | | | | | | | | | | | | | | Previously this excluded callables that return non-moveable types. This is the same as the [libc++ std::is_invocable_r bug](https://github.com/llvm/llvm-project/issues/55346) fixed by [this commit](https://github.com/llvm/llvm-project/commit/c3a24882903d): it's wrong to use std::is_convertible for checking the return type, since (despite its name) that doesn't check the standard-defined notion of "implicitly convertible". Instead we must base the check on whether the source type can be used as an argument to a function that accepts the destination type. PiperOrigin-RevId: 451341205 Change-Id: I2530051312a0361ea7a2ce26993ae973c9242089
* gmock-spec-builders: move a method to the header.Aaron Jacobs2022-05-262-133/+134
| | | | | | | | In order to make the diff more readable in an upcoming commit that requires the method to be templated on the action's result type. PiperOrigin-RevId: 451157029 Change-Id: I57beb7544efccd0459efb3a1f039ea45cd7c7602
* gmock-internal-utils.cc: Avoid implicit conversion from int to charDino Radakovic2022-05-171-1/+1
| | | | | | | Fixes #3832 PiperOrigin-RevId: 449158813 Change-Id: Ibe85239ab1f123097b2c1b61616c9d611e5b90d0
* gmock-actions: add support for move-only values to Return.Aaron Jacobs2022-05-132-29/+83
| | | | | | | | `Return(x)` can now be used directly with `WillOnce` (the only place it makes sense in the type system), without using `ByMove`. PiperOrigin-RevId: 448380066 Change-Id: Ia71cc60ccbc3b99720662731a2d309735a5ce7c8
* gmock-actions: provide a const reference when converting in ReturnAction.Aaron Jacobs2022-05-122-47/+67
| | | | | | | | It doesn't make semantic sense for the conversion to modify the input, and the fact that it's allowed to do so appears to have just been a historical accident. PiperOrigin-RevId: 448135555 Change-Id: Id10f17af38cf3947ee25fe10654d97527173ebfc
* gmock-actions: simplify Return and add better documentation.Aaron Jacobs2022-05-113-93/+192
| | | | | | | | | | Better document requirements, API decisions, and historical accidents. Make an implicit conversion easier and in a more appropriate place, and ease the burden of some assertions in the conversion operator. Stop using the legacy ActionInterface style for defining the action. PiperOrigin-RevId: 447894892 Change-Id: I179e23ec2abdd9bf05c204ab18dbb492f1372e8e
* gmock-actions: make OnceAction public.Aaron Jacobs2022-05-112-8/+8
| | | | | | | | So that it can be referenced in conversion operators for actions that need to know the concrete return type. PiperOrigin-RevId: 447889344 Change-Id: I643d3298bc8effd08741282a956c221f9d67d378
* Fix example of DescribeMatcher to properly support negation.Abseil Team2022-05-031-1/+2
| | | | | PiperOrigin-RevId: 446259163 Change-Id: I3ad5f405f44fc233f5cf5a18a274a9104b5c4ab8
* gmock-actions: remove a no-longer-necessary friend declaration.Aaron Jacobs2022-05-021-6/+0
| | | | | PiperOrigin-RevId: 445940487 Change-Id: I26952a72327db0d308bbe57ca4d1d91a0d7defc8
* gmock-actions: support ByMove in a specialization of ReturnAction.Aaron Jacobs2022-05-021-25/+34
| | | | | | | | | | | | | Rather than branching on whether the return type is ByMoveWrapper within ReturnAction itself, hoist the distinction to outside. This allows the main class template to be modified without worrying about this special case, which means we can stop using a shared pointer to the value (introduced as a linked_ptr in commit 3d1c78b2bf to support ByMove) in this commit and simplify the class template further in a future commit with the eventual aim of directly supporting move-only result types. PiperOrigin-RevId: 445938943 Change-Id: I7bc71ea301d5e493ac6ecbe57d62738a48a2721a
* gmock-actions: improve comments and tests for the implicit cast in Return.Aaron Jacobs2022-04-272-7/+39
| | | | | | | | | | Commit a070cbd91c added an implicit cast to this path but didn't leave a very clear explanation for why it was desirable, a clear example, or even test coverage. Add a better comment and a test that fails when the implicit cast is removed. PiperOrigin-RevId: 444871311 Change-Id: I127982fa8d5bce9b6d1b68177c12dc0709449164
* Support move-only and &&-qualified actions in WithArgs.Aaron Jacobs2022-04-262-9/+73
| | | | | PiperOrigin-RevId: 444671005 Change-Id: I7df5f038caf17afb60d4fb35434ff0b656d4c954
* Generalize gmock-matchers_test to handle is_gtest_matcher-style matchers, too.Abseil Team2022-04-265-50/+144
| | | | | PiperOrigin-RevId: 444586594 Change-Id: I0de9b40b3773e3047a492f050266967ea935ae3e