Commit Graph

853 Commits

Author SHA1 Message Date
CJ Johnson
7153098229 Merge pull request #3429 from 1KoT1:master
PiperOrigin-RevId: 379625931
2021-06-17 12:52:27 -04:00
Vasilii Pochkaenko
5ef9f63a72 feat: make a matcher ElementsAreArray applicable for std ranges 2021-06-15 16:42:40 +07:00
dmauro
8ceecc27c7 Googletest export
Updates Linux docker image to use Bazel 4.1.0 and GCC 11.1
Updates Bazel dependencies
Removes the last usage of the deprecated and removed Python2

PiperOrigin-RevId: 375759184
2021-06-02 17:54:36 -04:00
Abseil Team
662fe38e44 Googletest export
Support templating MockFunction over function objects besides std::function.

PiperOrigin-RevId: 373586967
2021-05-13 15:08:57 -04:00
John Bampton
050b517518 chore: fix spelling 2021-04-15 11:53:53 +10:00
Abseil Team
c3fc92f0b7 Googletest export
Update docs to point to the github.io pages.

PiperOrigin-RevId: 367711335
2021-04-12 20:14:19 -07:00
Austin Sullivan
9c047902ac
Update nicestrictnaggy gmock cook_book links
An incorrect link is output to the user when these conditions are met.
2021-03-17 10:33:19 -04:00
Abseil Team
98ca420679 Googletest export
Internal change

PiperOrigin-RevId: 362040448
2021-03-16 09:50:49 -04:00
Abseil Team
861d535e25 Googletest export
Update READMEs and issue template

PiperOrigin-RevId: 361931644
2021-03-10 08:49:32 -08:00
Abseil Team
bf465ff05d Internal change
PiperOrigin-RevId: 361213113
2021-03-09 10:59:19 -08:00
Abseil Team
e7e591764b Googletest export
Format WORKSPACE and googlemock/test/BUILD.bazel using buildifier

PiperOrigin-RevId: 360913861
2021-03-04 12:07:39 -05:00
Abseil Team
5893778716 Googletest export
Update stale links to `gmock_cook_book.md`.

I'm a new googletest user and found these links broken when reading the documentation.

PiperOrigin-RevId: 357786392
2021-02-18 13:27:00 -05:00
Abseil Team
0a3a3a845e Googletest export
Make include guards conform with https://google.github.io/styleguide/cppguide.html#The__define_Guard, attempt #2

PiperOrigin-RevId: 357056902
2021-02-18 13:26:24 -05:00
Abseil Team
eac6a02cc2 Googletest export
Mark move constructor noexcept

PiperOrigin-RevId: 356772642
2021-02-11 12:49:46 -05:00
Abseil Team
d4144d4ee2 Googletest export
Revert include guard fix

PiperOrigin-RevId: 356588893
2021-02-11 12:49:24 -05:00
Andy Soffer
e165773418 Merge pull request #3262 from platisd:master
PiperOrigin-RevId: 356568444
2021-02-11 12:49:08 -05:00
Abseil Team
9c2293af06 Googletest export
Fix build for MinGW + clang

In [1], empty_bases "is only supported when using the Microsoft C++ ABI." Disable it for MinGW.

https://clang.llvm.org/docs/AttributeReference.html#empty-bases

PiperOrigin-RevId: 356373782
2021-02-11 12:48:52 -05:00
Abseil Team
36b7792047 Googletest export
Make include guards conform with https://google.github.io/styleguide/cppguide.html#The__define_Guard

PiperOrigin-RevId: 355882793
2021-02-11 12:48:43 -05:00
platisd
46b188577b Do not include void into mocked method arguments
If a function that takes no arguments explicitly states (void)
then do not include it in the mocked method argument list
since it triggers static assertions that expect no arguments
to be present.

Fixes (?) #3261
2021-02-05 21:30:10 +01:00
Abseil Team
f4e7727cf4 Googletest export
Fix includes in fuse_gmock_files.py

PiperOrigin-RevId: 355166403
2021-02-05 10:40:23 -08:00
Abseil Team
d114398800 Googletest export
Remove uses of GTEST_HAS_TYPED_TEST_P and GTEST_HAS_TYPED_TEST.

PiperOrigin-RevId: 353935996
2021-02-05 10:39:30 -08:00
ofats
59dea67b81 Googletest export
Remove scripts for code generating together with related files.

PiperOrigin-RevId: 352805926
2021-01-26 15:43:04 -05:00
Abseil Team
997c36c188 Googletest export
Stop using pump for generating internal/custom/gmock-generated-actions.h

PiperOrigin-RevId: 352660735
2021-01-26 15:42:55 -05:00
Abseil Team
2c06d021d6 Googletest export
Internal change

PiperOrigin-RevId: 352607401
2021-01-26 15:42:30 -05:00
Abseil Team
14098f2015 Googletest export
Merge CONTRIBUTORS, delete LICENSEs in googletest/ and googlemock/

PiperOrigin-RevId: 352558822
2021-01-26 15:42:13 -05:00
Abseil Team
d128fc8252 Googletest export
Fixes #3222, fixes #3225, closes #3223

PiperOrigin-RevId: 352066131
2021-01-15 15:54:03 -05:00
Abseil Team
41ecb10253 Googletest export
Internal change

PiperOrigin-RevId: 352002166
2021-01-15 15:53:47 -05:00
Abseil Team
a2f906be69 Googletest export
Add "using is_gtest_matcher = void" to the DivisibleBy7Matcher example.

PiperOrigin-RevId: 351797821
2021-01-15 15:53:22 -05:00
Abseil Team
c13c27a513 Googletest export
Change Matcher<T> to allow binding an implementation by value directly:
 - Drop the requirement of MatcherInterface. Doing manual type erasure avoid
   extra layers in many cases.
 - Avoid the adaptor for `MatcherInterface<T>` and `MatcherInterface<const T&>` mismatch.
 - Use a small object optimization when possible. This makes things like
   `_` and `Eq(1)` really cheap and do not require memory allocations.
 - Migrate some matchers to the new model to speed them up and to test the new framework. More matchers to come in future changes.

PiperOrigin-RevId: 350580998
2021-01-13 20:59:20 -05:00
Abseil Team
489283524e Googletest export
Move all docs into top-level docs/ directory

PiperOrigin-RevId: 350211277
2021-01-13 20:59:12 -05:00
Abseil Team
95a9bdd9f9 Googletest export
Use an OrderedDict to store templated_types in the AST so that gmock knows how to properly construct the templated Mock class.

This is necessary for functions that make use of the templated typename as an argument or return type.

PiperOrigin-RevId: 349405731
2021-01-13 20:58:49 -05:00
Derek Mauro
d72813110c Merge pull request #3189 from ellert:gtest-help-test-GNU/kFreeBSD
PiperOrigin-RevId: 349349288
2021-01-13 20:58:40 -05:00
Derek Mauro
389cb68b87 Merge pull request #3094 from chuckatkins:update-deprecated-cmake-version
PiperOrigin-RevId: 349296827
2020-12-28 13:32:06 -05:00
Abseil Team
ca4b7c9ff4 Googletest export
Give each of Naggy/Nice/StrictMock a base class whose constructor runs before
the mocked class's constructor, and a destructor that runs after the mocked
class's destructor, so that any mock methods run in either the constructor or
destructor use the same strictness as other calls.

PiperOrigin-RevId: 348511612
2020-12-22 12:15:41 -05:00
dmauro
4f6fa70870 Googletest export
Internal Change

PiperOrigin-RevId: 347631521
2020-12-22 12:15:22 -05:00
Abseil Team
18f8200e30 Googletest export
Add static_asserts that verify that no class hierarchy contains more than one
of {NiceMock, NaggyMock, StrictMock}. This sort of nesting has always been
disallowed, but this CL adds a compile-time check to prevent it.

PiperOrigin-RevId: 347037822
2020-12-11 22:11:39 -05:00
dmauro
fb4b3b6b9a Googletest export
Fix a missing Bazel build dependency

PiperOrigin-RevId: 346783462
2020-12-10 17:56:26 -05:00
Abseil Team
e5644f5f12 Googletest export
Introduce a new `Address` matcher to gmock.

PiperOrigin-RevId: 346344591
2020-12-08 19:15:35 -05:00
Abseil Team
8779937dd0 Googletest export
Fix errata in gmock cook_book.md ON_CALL example

PiperOrigin-RevId: 346165890
2020-12-07 18:04:19 -05:00
Abseil Team
a02a591605 Googletest export
Add a `Pointer` matcher as an analog to `Pointee`.

Similar to `Pointee`, `Pointer` works with either raw or smart pointers and
allows creating a matcher like Pointer(Eq(foo)) for smart pointers.

PiperOrigin-RevId: 346164768
2020-12-07 18:04:12 -05:00
Abseil Team
93748a9466 Googletest export
Disable a gmock matcher test under MSVC 2015 (version 14) and earlier.  It interacts badly with Windows structured exceptions in a way we do not have the resources to investigate.  This test passes under MSVC 2017 and SEH.

PiperOrigin-RevId: 345496734
2020-12-03 15:42:58 -05:00
Abseil Team
1544828d27 Googletest export
Put "value" in SetArgReferee's description between code backticks.

PiperOrigin-RevId: 344054658
2020-12-02 18:23:14 -05:00
Abseil Team
9dce5e5d87 Googletest export
Use override instead of virtual for destructor

https://google.github.io/styleguide/cppguide.html says: "Explicitly annotate overrides of virtual functions or virtual destructors with exactly one of an override or (less frequently) final specifier. Do not use virtual when declaring an override". The mocked class _should_ have a virtual destructor most of the times.

PiperOrigin-RevId: 342082140
2020-11-13 10:57:24 -05:00
Abseil Team
a1adec799a Googletest export
Use a tagged constructor for FlatTuple instead.
Some versions of MSVC are getting confused with that constructor and generating invalid code.

PiperOrigin-RevId: 342050957
2020-11-12 13:32:33 -05:00
dmauro
336fd36fee Googletest export
Rollback change from
https://github.com/google/googletest/pull/1836. This change generates
a script on Windows to actually run each test, but the script itself
doesn't correctly report if the test passed.

This change will "break tests" that were already broken on Windows,
but weren't being reported as such.

PiperOrigin-RevId: 341850671
2020-11-12 13:32:03 -05:00
Abseil Team
fbef0711cf Googletest export
Change ACTION{,_Pn,_TEMPLATE} macros to build functors rather than ActionInterface<> subclasses, thus changing the Action<> wrappers they create to use the modernized (non-const) argument tuple type, allowing these macros to mutate their arguments.

Functor-based Action<>s deep-copy the implementing object, so have the functors use a shared_ptr to the non-trivial state of bound value parameters.  No longer specialize that shared state to the particular action signature, encoding that information instead only in the instantiation of the implementation function.

PiperOrigin-RevId: 341116208
2020-11-09 15:43:33 -05:00
Abseil Team
0c400f67fc Googletest export
GMock: Make Truly explain when it fails

I just wrote a test that had a matcher of the form
  Optional(AllOf(
    SomeMatcher,
    SomeOtherMatcher,
    Truly(SomePredicate)))

The predicate failed, the other two matchers succeeded, and I got a hard-to-interpret message saying that the value in the optional "didn't match". Didn't match what?

This change improves situations like that slightly by having Truly explain to its result listener when it fails. When there are multiple Trulys in an AllOf, there will be some ambiguity, but it will at least provide more information than right now.

PiperOrigin-RevId: 341105141
2020-11-09 15:43:24 -05:00
Abseil Team
d89b363021 Googletest export
Add support for ref qualifiers in MOCK_METHOD.

PiperOrigin-RevId: 341047839
2020-11-06 13:23:55 -05:00
ofats
710f9c11ca Googletest export
Rewrite InvokeArgument action without using pump.

PiperOrigin-RevId: 340861582
2020-11-05 15:07:26 -05:00
Andy Getz
fb98f7447e Merge pull request #3008 from hyukmyeong:update_tutorial
PiperOrigin-RevId: 340286884
2020-11-02 22:26:39 -05:00