summaryrefslogtreecommitdiff
path: root/googletest/docs
diff options
context:
space:
mode:
authorkrzysio <krzysio@google.com>2020-08-12 18:59:05 -0400
committerGennadiy Rozental <rogeeff@google.com>2020-08-14 03:16:24 -0400
commitadeef192947fbc0f68fa14a6c494c8df32177508 (patch)
treef9f28b5f2245acb2f7fb5223cd3ed78677af3096 /googletest/docs
parent10ade8473b698a8fe14ddb518c2abd228669657a (diff)
downloadgoogletest-git-adeef192947fbc0f68fa14a6c494c8df32177508.tar.gz
Googletest export
Mention matchers as an alternative to assertions in subroutines. Matchers are often the better choice - they can provide more informative error messages and circumvent all of the complexity described in this section. PiperOrigin-RevId: 326332149
Diffstat (limited to 'googletest/docs')
-rw-r--r--googletest/docs/advanced.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/googletest/docs/advanced.md b/googletest/docs/advanced.md
index f667532f..32819b6b 100644
--- a/googletest/docs/advanced.md
+++ b/googletest/docs/advanced.md
@@ -911,6 +911,12 @@ handlers registered with `pthread_atfork(3)`.
## Using Assertions in Sub-routines
+Note: If you want to put a series of test assertions in a subroutine to check
+for a complex condition, consider using
+[a custom GMock matcher](../../googlemock/docs/cook_book.md#NewMatchers)
+instead. This lets you provide a more readable error message in case of failure
+and avoid all of the issues described below.
+
### Adding Traces to Assertions
If a test sub-routine is called from several places, when an assertion inside it