Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
354fc8d8
Commit
354fc8d8
authored
Jan 18, 2018
by
Fedor Trushkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document ScopedTrace utility
parent
9c82e774
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
AdvancedGuide.md
googletest/docs/AdvancedGuide.md
+9
-7
No files found.
googletest/docs/AdvancedGuide.md
View file @
354fc8d8
...
@@ -787,15 +787,17 @@ If a test sub-routine is called from several places, when an assertion
...
@@ -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
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
sub-routine the failure is from. You can alleviate this problem using
extra logging or custom failure messages, but that usually clutters up
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
where
`message`
can be anything streamable to
`std::ostream`
.
`SCOPED_TRACE`
macro will cause the current file name, line number, and the given
macro will cause the current file name, line number, and the given message to be
message to be added in every failure message. The effect will be
added in every failure message.
`ScopedTrace`
accepts explicit file name and
undone when the control leaves the current lexical scope.
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,
For example,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment