Commit Graph

156 Commits

Author SHA1 Message Date
Abseil Team
489283524e Googletest export
Move all docs into top-level docs/ directory

PiperOrigin-RevId: 350211277
2021-01-13 20:59:12 -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
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
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
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
d89b363021 Googletest export
Add support for ref qualifiers in MOCK_METHOD.

PiperOrigin-RevId: 341047839
2020-11-06 13:23:55 -05:00
Abseil Team
a462188865 Googletest export
Add ::testing::FieldsAre matcher for objects that support get<> and structured bindings.
PiperOrigin-RevId: 337165285
2020-10-14 18:27:07 -04:00
Abseil Team
8ccc5ec5c0 Googletest export
Removing a semicolon that triggers a lint error in sample code.

PiperOrigin-RevId: 337095451
2020-10-14 18:26:41 -04:00
Derek Mauro
6abcfac2f2 Merge pull request #3050 from peternewman:patch-1
PiperOrigin-RevId: 336881266
2020-10-14 18:25:57 -04:00
Abseil Team
d4df326d6f Googletest export
Use absl::StrCat in MATCHER_P example for consistency with https://abseil.io/tips/3

PiperOrigin-RevId: 336878481
2020-10-14 18:25:49 -04:00
Abseil Team
d11c76175f Googletest export
Suggest using generic lambdas for composing macros.

Long chains of macros hurt legibility; generic lambdas are an easy way to abbreviate them, but are not an obvious solution to casual users.

Compare:
EXPECT_THAT(f(), ElementsAre(
    Property(&MyClass::foo, Property(&OtherClass::bar, Contains("x"))),
    Property(&MyClass::foo, Property(&OtherClass::bar, Contains("y"))));
to:
EXPECT_THAT(f(), ElementsAre(HasFooBar("x"), HasFooBar("y")));
PiperOrigin-RevId: 336870137
2020-10-14 18:25:40 -04:00
Peter Newman
870a6b5563
Fix a typo 2020-10-12 06:23:18 +01:00
keshavgbpecdelhi
1f3484a2b7
Update cook_book.md
Please note that changing the default value for a type can make [you]* test.....
Here "you" word doesn't make sense.. rather "your" seems to make it understandable.
2020-09-27 15:27:14 +05:30
Abseil Team
df94fc5f7e Googletest export
Address OSS Issue #2463 https://github.com/google/googletest/issues/2463

PiperOrigin-RevId: 333289989
2020-09-24 12:06:34 -04:00
Abseil Team
7aca84427f Googletest export
Simplify FooConcrete static calls in googlemock cookbook.

PiperOrigin-RevId: 332437041
2020-09-20 18:48:41 -04:00
Derek Mauro
646603961b Merge pull request #2994 from xerus2000:gmock-docs
PiperOrigin-RevId: 330545489
2020-09-10 19:09:21 -04:00
xerus2000
296c9d29b1 Add timestamp to in old method mock macro guide 2020-08-25 10:07:30 +02:00
Abseil Team
fc1e778899 Googletest export
Fix DoAll to work with move-only sink arguments.

This changes types of the first n - 1 actions so that they only get a readonly
view of the arguments. The last action will accept move only objects.

PiperOrigin-RevId: 327031893
2020-08-23 23:50:54 -04:00
Abseil Team
10ade8473b Googletest export
internal change

PiperOrigin-RevId: 326080000
2020-08-12 02:41:20 -04:00
Abseil Team
5a5caab358 Googletest export
Fix DoAll to work with move-only sink arguments.

This changes types of the first n - 1 actions so that they only get a readonly
view of the arguments. The last action will accept move only objects.

PiperOrigin-RevId: 324619666
2020-08-07 13:08:00 -04:00
Abseil Team
48ec64092a Googletest export
Fix DoAll to work with move-only sink arguments.

This changes types of the first n - 1 actions so that they only get a readonly
view of the arguments. The last action will accept move only objects.

PiperOrigin-RevId: 324600664
2020-08-07 13:07:51 -04:00
Abseil Team
18a9aeda7a Googletest export
Internal documentation change.

PiperOrigin-RevId: 323612305
2020-07-28 14:22:08 -04:00
ofats
c64309924d Googletest export
Stop using ADL for InvokeArgument action.

PiperOrigin-RevId: 323234396
2020-07-28 14:21:59 -04:00
ofats
08b787796c Googletest export
Replace ByRef with std::ref everywhere in docs.

PiperOrigin-RevId: 320002303
2020-07-09 13:35:18 -04:00
Abseil Team
e5613588a1 Googletest export
Normalize headers in gMock docs

Increasing Header levels on two pages, to better match other pages in the same directory.

PiperOrigin-RevId: 318280892
2020-06-26 12:04:05 -04:00
Abseil Team
549c5d061e Googletest export
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
2020-06-15 16:56:42 -04:00
Abseil Team
210aab09de Googletest export
gMock Cookbook: Slight rewording

Remove "I" because documentation can have multiple authors. And remove unnecessary "guy".

PiperOrigin-RevId: 314533746
2020-06-05 03:56:49 -04:00
Abseil Team
26dadc2241 Googletest export
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
2020-06-02 20:45:11 -04:00
Abseil Team
6b08b41e5f Googletest export
Spell out namespace for absl::Notification.

PiperOrigin-RevId: 312300192
2020-05-28 19:54:10 -04:00
Abseil Team
fe5300ebf1 Googletest export
Addresses https://github.com/google/googletest/pull/2784

PiperOrigin-RevId: 310902202
2020-05-13 00:39:40 -04:00
Abseil Team
3cfb4117f7 Googletest export
Fix link to "high-perf dependency injection technique".

PiperOrigin-RevId: 308893893
2020-05-01 17:12:19 -04:00
Abseil Team
1293297874 Googletest export
internal change

PiperOrigin-RevId: 308648034
2020-05-01 17:11:52 -04:00
Abseil Team
373d72b698 Googletest export
Fix link to "After clause". Sorry, reader, but this heading is in another document!

PiperOrigin-RevId: 305947971
2020-04-16 13:32:42 -04:00
Abseil Team
749148f1ac Googletest export
Internal change

PiperOrigin-RevId: 302048013
2020-03-20 20:15:32 -04:00
Abseil Team
cfb5ef4e7d Googletest export
Remove public buganizer reference from googletest cookbook.

It also seems that this bug is obsolete.

PiperOrigin-RevId: 298598298
2020-03-17 17:19:51 -04:00
Abseil Team
fd538161f4 Googletest export
Allow construction of an Action from a callable of zero args

Action already allows construction from a callable with the same args as the mocked function, without needing to wrap the callable in Invoke. However, if you don't care about the arguments to the mocked function you need to either accept all of them or wrap your callable in InvokeWithoutArgs. This change makes both of those unnecessary, since it allows you to pass a no-args callable to Action directly.

PiperOrigin-RevId: 296117034
2020-02-28 16:40:53 -05:00
Abseil Team
11d9834e98 Googletest export
...text exposed to GitHub repo https://www.github.com/google/googletest

PiperOrigin-RevId: 293438092
2020-02-07 13:35:19 -05:00
Abseil Team
153909f096 Googletest export
Fix typo in example.

PiperOrigin-RevId: 287212448
2020-01-02 16:49:14 -05:00
krzysio
0a0c826629 Googletest export
Don't use fully qualified ::std types in code examples.

Having a nested user-defined 'std' namespace anywhere in a program is a minefield and shouldn't be either explicitly supported or implicitly condoned.

PiperOrigin-RevId: 285790182
2019-12-16 16:03:51 -05:00
Abseil Team
ae8d1fc81b Googletest export
Clarify use of IsTrue and IsFalse matchers.

These matchers are subtle and confusing: what are they for?
The docs in the code are clear, but not very accessible.
googletest/googlemock/include/gmock/gmock-more-matchers.h

PiperOrigin-RevId: 283393275
2019-12-02 16:42:01 -05:00
Abseil Team
4bf466236d Googletest export
Add a breadcrumb about nullopt comparison near the Optional() matcher.

Also add a note about how otherwise-spurious 'Eq()' may be needed in some cases. Without this, something like Field(&MyStruct::optional_field_without_equals_equals, absl::nullopt) doesn't work - it converts the nullopt to an optional<> of the non-equalable type, and fails to select the operator==(optional<>, nullopt_t) overload. The Eq() lets the type persist later into the match.

PiperOrigin-RevId: 281305519
2019-11-20 14:16:45 -05:00
Xiaoyi Zhang
8aedd597af Merge pull request #2548 from kuzkry:update-pump-manual
PiperOrigin-RevId: 278702531
2019-11-05 17:08:27 -05:00
Krystian Kuzniarek
523ad489ef update pump_manual.md 2019-11-02 01:08:24 +01:00
Abseil Team
a1f71dd56d Googletest export
Remove badly formatted suggestion in gmock cheat sheet.

PiperOrigin-RevId: 277060475
2019-10-29 16:51:01 -04:00
Krystian Kuzniarek
002905f29f move the pumping script to googlemock 2019-10-25 17:03:39 +02:00
Abseil Team
37f3227831 Googletest export
Add a matcher `testing::ReturnRoundRobin` which, on each call, returns the next element in the sequence, restarting at the beginning once it has reached the end.

PiperOrigin-RevId: 276312136
2019-10-23 15:54:45 -04:00
Abseil Team
011c4e23d5 Googletest export
Rolling forward IsNan() matcher with fixes in test for -Wconversion issues. Use
std::nanf and std::nanl where appropriate.
PiperOrigin-RevId: 275523003
2019-10-22 09:37:46 -04:00