Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorLeitwolf112026-11-01 20:05:56 +0300
committerLeitwolf112026-11-01 20:05:56 +0300
commit8603d31fd8c1a72e30cb444f278d7a0592383ba7 (patch)
tree496d26ff659e92cdf4e6fe27a4aa47bf52818052 /docs
parent2aea9dafd283d69bec459ea0d495c25d1f6a0f94 (diff)
downloadcatch3-feature/mocking.tar.gz
Answer the review of the mocksfeature/mocking
A report no longer throws, so a noexcept mock survives an aborting run. A call that has nothing to return still leaves the test case, which ends the process in a noexcept function; the documentation says so. RunContext clears the result capture when it goes, so a mock of static lifetime finds none and writes to standard error. Decision owns its source line, since Verify can free the expectation while a call is on its way. Moving a result out takes the lock. Vector matchers refer to their vector, so they are rejected at compile time like composed ones. A null text expectation accepts only null, and integers compare by value, so 256 no longer accepts an unsigned char.
Diffstat (limited to 'docs')
-rw-r--r--docs/progmasoft-mocking.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/progmasoft-mocking.md b/docs/progmasoft-mocking.md
index 98c372ec..f79a537e 100644
--- a/docs/progmasoft-mocking.md
+++ b/docs/progmasoft-mocking.md
@@ -67,14 +67,15 @@ accepts any arguments; otherwise each parameter takes one of these:
| Written as | Accepts |
| --- | --- |
-| a value | what compares equal to it; strings compare by value, also as `const char *` |
+| a value | what compares equal to it; strings compare by value, also as `const char *`, and integers by value whatever their types, so 256 never accepts an `unsigned char` |
| a Catch matcher, such as `StartsWith("a")` | what the matcher accepts |
| `Any` | anything |
| `Where(predicate, "description")` | what the predicate accepts |
A composition such as `StartsWith("a") && EndsWith("z")` refers to temporaries
-that are gone when the mock is called, so it does not compile here; put it in a
-`Where`.
+that are gone when the mock is called, and Catch's vector matchers, such as
+`Equals(vector)`, refer to their vector. Neither compiles here; put them in a
+`Where`. A matcher of your own has to hold what it compares with.
The result of `CATCH3_EXPECT_CALL` takes these, in any order:
@@ -91,7 +92,8 @@ accepts its arguments and can take another call. A call none of them accepts
fails the test case and returns a value-initialized result. So does a call they
accept when all of them are used up. When the result cannot be made that way, a
reference for example, the test case ends there; the same happens to an
-expectation with no `Returns` or `Does`.
+expectation with no `Returns` or `Does`. A `noexcept` function cannot leave the
+test case that way, so such a call ends the process.
A mock with no expectation for a call treats it as a failure. An expectation
with `AnyTimes()` is how to allow calls that do not matter to the test.