From adeef192947fbc0f68fa14a6c494c8df32177508 Mon Sep 17 00:00:00 2001 From: krzysio Date: Wed, 12 Aug 2020 18:59:05 -0400 Subject: [PATCH] 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 --- googletest/docs/advanced.md | 6 ++++++ 1 file changed, 6 insertions(+) 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