summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2022-04-09 01:39:39 (GMT)
committerCopybara-Service <copybara-worker@google.com>2022-04-09 01:40:07 (GMT)
commita1cc8c55195661a58ad60c3bb062a0b9c302710d (patch)
tree4a2dc2bc70e5cbcf086e8090796b4675958c518c /docs
parent5f467ec04df33024e3c6760fa403b5cd5d8e9ace (diff)
downloadgoogletest-a1cc8c55195661a58ad60c3bb062a0b9c302710d.zip
googletest-a1cc8c55195661a58ad60c3bb062a0b9c302710d.tar.gz
googletest-a1cc8c55195661a58ad60c3bb062a0b9c302710d.tar.bz2
Add support for move-only and &&-qualified actions in WillOnce.
This provides a type-safe way for an action to express that it wants to be called only once, or to capture move-only objects. It is a generalization of the type system-evading hack in ByMove, with the improvement that it works for _any_ action (including user-defined ones), and correctly expresses that the action can only be used with WillOnce. I'll make existing actions benefit in a future commit. PiperOrigin-RevId: 440496139 Change-Id: I4145d191cca5655995ef41360bb126c123cb41d3
Diffstat (limited to 'docs')
-rw-r--r--docs/reference/mocking.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/reference/mocking.md b/docs/reference/mocking.md
index c29f716..e414ffb 100644
--- a/docs/reference/mocking.md
+++ b/docs/reference/mocking.md
@@ -248,7 +248,9 @@ EXPECT_CALL(my_mock, GetNumber())
.WillOnce(Return(3));
```
-The `WillOnce` clause can be used any number of times on an expectation.
+The `WillOnce` clause can be used any number of times on an expectation. Unlike
+`WillRepeatedly`, the action fed to each `WillOnce` call will be called at most
+once, so may be a move-only type and/or have an `&&`-qualified call operator.
#### WillRepeatedly {#EXPECT_CALL.WillRepeatedly}