summaryrefslogtreecommitdiffstats
path: root/googletest/docs
diff options
context:
space:
mode:
authorFedor Trushkin <ftrushkin@google.com>2018-01-18 09:34:05 (GMT)
committerFedor Trushkin <ftrushkin@google.com>2018-01-18 09:34:05 (GMT)
commit354fc8d8b1889b580f46416c9bbdf5ed8453156f (patch)
tree68329a6b7bb626c14599284262165f4c0c5f7937 /googletest/docs
parent9c82e7745c257f38d7dd7ff8a9759ea58b6a4e89 (diff)
downloadgoogletest-354fc8d8b1889b580f46416c9bbdf5ed8453156f.zip
googletest-354fc8d8b1889b580f46416c9bbdf5ed8453156f.tar.gz
googletest-354fc8d8b1889b580f46416c9bbdf5ed8453156f.tar.bz2
Document ScopedTrace utility
Diffstat (limited to 'googletest/docs')
-rw-r--r--googletest/docs/AdvancedGuide.md16
1 files changed, 9 insertions, 7 deletions
diff --git a/googletest/docs/AdvancedGuide.md b/googletest/docs/AdvancedGuide.md
index e4dd94d..6c156bb 100644
--- a/googletest/docs/AdvancedGuide.md
+++ b/googletest/docs/AdvancedGuide.md
@@ -787,15 +787,17 @@ If a test sub-routine is called from several places, when an assertion
inside it fails, it can be hard to tell which invocation of the
sub-routine the failure is from. You can alleviate this problem using
extra logging or custom failure messages, but that usually clutters up
-your tests. A better solution is to use the `SCOPED_TRACE` macro:
+your tests. A better solution is to use the `SCOPED_TRACE` macro or
+the `ScopedTrace` utility:
-| `SCOPED_TRACE(`_message_`);` |
-|:-----------------------------|
+| `SCOPED_TRACE(`_message_`);` | `ScopedTrace trace(`_"file\_path"_`, `_line\_number_`, `_message_`);` |
+|:-----------------------------|:----------------------------------------------------------------------|
-where _message_ can be anything streamable to `std::ostream`. This
-macro will cause the current file name, line number, and the given
-message to be added in every failure message. The effect will be
-undone when the control leaves the current lexical scope.
+where `message` can be anything streamable to `std::ostream`. `SCOPED_TRACE`
+macro will cause the current file name, line number, and the given message to be
+added in every failure message. `ScopedTrace` accepts explicit file name and
+line number in arguments, which is useful for writing test helpers. The effect
+will be undone when the control leaves the current lexical scope.
For example,