Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
13218917
Unverified
Commit
13218917
authored
Jan 11, 2018
by
Gennadiy Civil
Committed by
GitHub
Jan 11, 2018
Browse files
Merge pull request #1399 from gennadiycivil/master
Merging, Upstream cl 103120214
parents
836c419c
5add3477
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
7 deletions
+33
-7
googletest/include/gtest/gtest.h
googletest/include/gtest/gtest.h
+6
-1
googletest/include/gtest/internal/gtest-internal.h
googletest/include/gtest/internal/gtest-internal.h
+25
-3
googletest/src/gtest.cc
googletest/src/gtest.cc
+2
-3
No files found.
googletest/include/gtest/gtest.h
View file @
13218917
...
@@ -2110,9 +2110,14 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
...
@@ -2110,9 +2110,14 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
// of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
// to appear in the same block - as long as they are on different
// to appear in the same block - as long as they are on different
// lines.
// lines.
//
// Assuming that each thread maintains its own stack of traces.
// Therefore, a SCOPED_TRACE() would (correctly) only affect the
// assertions in its own thread.
#define SCOPED_TRACE(message) \
#define SCOPED_TRACE(message) \
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
__FILE__, __LINE__, ::testing::Message() << (message))
__FILE__, __LINE__, (message))
// Compile-time assertion for type equality.
// Compile-time assertion for type equality.
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
// StaticAssertTypeEq<type1, type2>() compiles iff type1 and type2 are
...
...
googletest/include/gtest/internal/gtest-internal.h
View file @
13218917
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
// Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
//
//
// The Google C++ Testing Framework (Google Test)
// The Google C++ Testing Framework (Google Test)
//
//
...
@@ -61,8 +60,8 @@
...
@@ -61,8 +60,8 @@
#include <vector>
#include <vector>
#include "gtest/gtest-message.h"
#include "gtest/gtest-message.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-filepath.h"
#include "gtest/internal/gtest-filepath.h"
#include "gtest/internal/gtest-string.h"
#include "gtest/internal/gtest-type-util.h"
#include "gtest/internal/gtest-type-util.h"
// Due to C++ preprocessor weirdness, we need double indirection to
// Due to C++ preprocessor weirdness, we need double indirection to
...
@@ -157,7 +156,28 @@ class GTEST_API_ ScopedTrace {
...
@@ -157,7 +156,28 @@ class GTEST_API_ ScopedTrace {
public:
public:
// The c'tor pushes the given source file location and message onto
// The c'tor pushes the given source file location and message onto
// a trace stack maintained by Google Test.
// a trace stack maintained by Google Test.
ScopedTrace
(
const
char
*
file
,
int
line
,
const
Message
&
message
);
// Template version. Uses Message() to convert the values into strings.
// Slow, but flexible.
template
<
typename
T
>
ScopedTrace
(
const
char
*
file
,
int
line
,
const
T
&
message
)
{
PushTrace
(
file
,
line
,
(
Message
()
<<
message
).
GetString
());
}
// Optimize for some known types.
ScopedTrace
(
const
char
*
file
,
int
line
,
const
char
*
message
)
{
PushTrace
(
file
,
line
,
message
?
message
:
"(null)"
);
}
#if GTEST_HAS_GLOBAL_STRING
ScopedTrace
(
const
char
*
file
,
int
line
,
const
::
string
&
message
)
{
PushTrace
(
file
,
line
,
message
);
}
#endif
ScopedTrace
(
const
char
*
file
,
int
line
,
const
std
::
string
&
message
)
{
PushTrace
(
file
,
line
,
message
);
}
// The d'tor pops the info pushed by the c'tor.
// The d'tor pops the info pushed by the c'tor.
//
//
...
@@ -166,6 +186,8 @@ class GTEST_API_ ScopedTrace {
...
@@ -166,6 +186,8 @@ class GTEST_API_ ScopedTrace {
~
ScopedTrace
();
~
ScopedTrace
();
private:
private:
void
PushTrace
(
const
char
*
file
,
int
line
,
std
::
string
message
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
ScopedTrace
);
GTEST_DISALLOW_COPY_AND_ASSIGN_
(
ScopedTrace
);
}
GTEST_ATTRIBUTE_UNUSED_
;
// A ScopedTrace object does its job in its
}
GTEST_ATTRIBUTE_UNUSED_
;
// A ScopedTrace object does its job in its
// c'tor and d'tor. Therefore it doesn't
// c'tor and d'tor. Therefore it doesn't
...
...
googletest/src/gtest.cc
View file @
13218917
...
@@ -3839,12 +3839,11 @@ void StreamingListener::SocketWriter::MakeConnection() {
...
@@ -3839,12 +3839,11 @@ void StreamingListener::SocketWriter::MakeConnection() {
// Pushes the given source file location and message onto a per-thread
// Pushes the given source file location and message onto a per-thread
// trace stack maintained by Google Test.
// trace stack maintained by Google Test.
ScopedTrace
::
ScopedTrace
(
const
char
*
file
,
int
line
,
const
Message
&
message
)
void
ScopedTrace
::
PushTrace
(
const
char
*
file
,
int
line
,
std
::
string
message
)
{
GTEST_LOCK_EXCLUDED_
(
&
UnitTest
::
mutex_
)
{
TraceInfo
trace
;
TraceInfo
trace
;
trace
.
file
=
file
;
trace
.
file
=
file
;
trace
.
line
=
line
;
trace
.
line
=
line
;
trace
.
message
=
message
.
GetString
(
);
trace
.
message
.
swap
(
message
);
UnitTest
::
GetInstance
()
->
PushGTestTrace
(
trace
);
UnitTest
::
GetInstance
()
->
PushGTestTrace
(
trace
);
}
}
...
...
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