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
0d6a674f
Unverified
Commit
0d6a674f
authored
Feb 13, 2018
by
Gennadiy Civil
Committed by
GitHub
Feb 13, 2018
Browse files
Merge pull request #1458 from gennadiycivil/master
cleanup, merges
parents
38611c51
68e4f076
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
32 additions
and
27 deletions
+32
-27
googletest/include/gtest/gtest-printers.h
googletest/include/gtest/gtest-printers.h
+1
-1
googletest/include/gtest/gtest_prod.h
googletest/include/gtest/gtest_prod.h
+7
-4
googletest/src/gtest-internal-inl.h
googletest/src/gtest-internal-inl.h
+2
-2
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+6
-2
googletest/src/gtest-typed-test.cc
googletest/src/gtest-typed-test.cc
+1
-0
googletest/src/gtest.cc
googletest/src/gtest.cc
+12
-16
googletest/test/gtest_env_var_test_.cc
googletest/test/gtest_env_var_test_.cc
+1
-0
googletest/test/gtest_main_unittest.cc
googletest/test/gtest_main_unittest.cc
+2
-2
No files found.
googletest/include/gtest/gtest-printers.h
View file @
0d6a674f
...
...
@@ -112,8 +112,8 @@
#endif
#if GTEST_HAS_ABSL
#include "absl/types/optional.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#endif // GTEST_HAS_ABSL
namespace
testing
{
...
...
googletest/include/gtest/gtest_prod.h
View file @
0d6a674f
...
...
@@ -40,17 +40,20 @@
//
// class MyClass {
// private:
// void
My
Method();
// FRIEND_TEST(MyClassTest,
My
Method);
// void
Private
Method();
// FRIEND_TEST(MyClassTest,
Private
Method
Works
);
// };
//
// class MyClassTest : public testing::Test {
// // ...
// };
//
// TEST_F(MyClassTest,
My
Method) {
// // Can call MyClass::
My
Method() here.
// TEST_F(MyClassTest,
Private
Method
Works
) {
// // Can call MyClass::
Private
Method() here.
// }
//
// Note: The test class must be in the same namespace as the class being tested.
// For example, putting MyClassTest in an anonymous namespace will not work.
#define FRIEND_TEST(test_case_name, test_name)\
friend class test_case_name##_##test_name##_Test
...
...
googletest/src/gtest-internal-inl.h
View file @
0d6a674f
...
...
@@ -59,7 +59,7 @@
# include <windows.h> // NOLINT
#endif // GTEST_OS_WINDOWS
#include "gtest/gtest.h"
// NOLINT
#include "gtest/gtest.h"
#include "gtest/gtest-spi.h"
namespace
testing
{
...
...
@@ -1024,7 +1024,7 @@ class TestResultAccessor {
#if GTEST_CAN_STREAM_RESULTS_
// Streams test results to the given port on the given host machine.
class
GTEST_API_
StreamingListener
:
public
EmptyTestEventListener
{
class
StreamingListener
:
public
EmptyTestEventListener
{
public:
// Abstract base class for writing strings to a socket.
class
AbstractSocketWriter
{
...
...
googletest/src/gtest-port.cc
View file @
0d6a674f
...
...
@@ -915,6 +915,7 @@ GTestLog::~GTestLog() {
posix
::
Abort
();
}
}
// Disable Microsoft deprecation warnings for POSIX functions called from
// this class (creat, dup, dup2, and close)
GTEST_DISABLE_MSC_WARNINGS_PUSH_
(
4996
)
...
...
@@ -1007,8 +1008,7 @@ static CapturedStream* g_captured_stderr = NULL;
static
CapturedStream
*
g_captured_stdout
=
NULL
;
// Starts capturing an output stream (stdout/stderr).
static
void
CaptureStream
(
int
fd
,
const
char
*
stream_name
,
static
void
CaptureStream
(
int
fd
,
const
char
*
stream_name
,
CapturedStream
**
stream
)
{
if
(
*
stream
!=
NULL
)
{
GTEST_LOG_
(
FATAL
)
<<
"Only one "
<<
stream_name
...
...
@@ -1049,6 +1049,10 @@ std::string GetCapturedStderr() {
#endif // GTEST_HAS_STREAM_REDIRECTION
size_t
GetFileSize
(
FILE
*
file
)
{
fseek
(
file
,
0
,
SEEK_END
);
return
static_cast
<
size_t
>
(
ftell
(
file
));
...
...
googletest/src/gtest-typed-test.cc
View file @
0d6a674f
...
...
@@ -30,6 +30,7 @@
// Author: wan@google.com (Zhanyong Wan)
#include "gtest/gtest-typed-test.h"
#include "gtest/gtest.h"
namespace
testing
{
...
...
googletest/src/gtest.cc
View file @
0d6a674f
...
...
@@ -2571,12 +2571,10 @@ void ReportInvalidTestCaseType(const char* test_case_name,
<<
"probably rename one of the classes to put the tests into different
\n
"
<<
"test cases."
;
GTEST_LOG_
(
ERROR
)
<<
FormatFileLocation
(
code_location
.
file
.
c_str
(),
GTEST_LOG_
(
ERROR
)
<<
FormatFileLocation
(
code_location
.
file
.
c_str
(),
code_location
.
line
)
<<
" "
<<
errors
.
GetString
();
}
}
// namespace internal
namespace
{
...
...
@@ -2898,7 +2896,7 @@ static int GetBitOffset(WORD color_mask) {
if
(
color_mask
==
0
)
return
0
;
int
bitOffset
=
0
;
while
((
color_mask
&
1
)
==
0
)
{
while
((
color_mask
&
1
)
==
0
)
{
color_mask
>>=
1
;
++
bitOffset
;
}
...
...
@@ -3106,7 +3104,6 @@ void PrettyUnitTestResultPrinter::OnTestIterationStart(
"Note: Randomizing tests' orders with a seed of %d .
\n
"
,
unit_test
.
random_seed
());
}
ColoredPrintf
(
COLOR_GREEN
,
"[==========] "
);
printf
(
"Running %s from %s.
\n
"
,
FormatTestCount
(
unit_test
.
test_to_run_count
()).
c_str
(),
...
...
@@ -3473,8 +3470,8 @@ void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
// 3. To interpret the meaning of errno in a thread-safe way,
// we need the strerror_r() function, which is not available on
// Windows.
GTEST_LOG_
(
FATAL
)
<<
"Unable to open file
\"
"
<<
output_file_
<<
"
\"
"
;
GTEST_LOG_
(
FATAL
)
<<
"Unable to open file
\"
"
<<
output_file_
<<
"
\"
"
;
}
std
::
stringstream
stream
;
PrintXmlUnitTest
(
&
stream
,
unit_test
);
...
...
@@ -3773,6 +3770,7 @@ std::string XmlUnitTestResultPrinter::TestPropertiesAsXmlAttributes(
// End XmlUnitTestResultPrinter
#if GTEST_CAN_STREAM_RESULTS_
// Checks if str contains '=', '&', '%' or '\n' characters. If yes,
...
...
@@ -4401,8 +4399,7 @@ void UnitTestImpl::ConfigureXmlOutput() {
UnitTestOptions
::
GetAbsolutePathToOutputFile
().
c_str
()));
}
else
if
(
output_format
!=
""
)
{
GTEST_LOG_
(
WARNING
)
<<
"WARNING: unrecognized output format
\"
"
<<
output_format
<<
"
\"
ignored."
;
<<
output_format
<<
"
\"
ignored."
;
}
}
...
...
@@ -4417,8 +4414,7 @@ void UnitTestImpl::ConfigureStreamingOutput() {
listeners
()
->
Append
(
new
StreamingListener
(
target
.
substr
(
0
,
pos
),
target
.
substr
(
pos
+
1
)));
}
else
{
GTEST_LOG_
(
WARNING
)
<<
"unrecognized streaming target
\"
"
<<
target
GTEST_LOG_
(
WARNING
)
<<
"unrecognized streaming target
\"
"
<<
target
<<
"
\"
ignored."
;
}
}
...
...
@@ -5255,8 +5251,7 @@ static bool ParseGoogleTestFlag(const char* const arg) {
static
void
LoadFlagsFromFile
(
const
std
::
string
&
path
)
{
FILE
*
flagfile
=
posix
::
FOpen
(
path
.
c_str
(),
"r"
);
if
(
!
flagfile
)
{
GTEST_LOG_
(
FATAL
)
<<
"Unable to open file
\"
"
<<
GTEST_FLAG
(
flagfile
)
GTEST_LOG_
(
FATAL
)
<<
"Unable to open file
\"
"
<<
GTEST_FLAG
(
flagfile
)
<<
"
\"
"
;
}
std
::
string
contents
(
ReadEntireFile
(
flagfile
));
...
...
@@ -5389,6 +5384,7 @@ std::string TempDir() {
#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_)
return
GTEST_CUSTOM_TEMPDIR_FUNCTION_
();
#endif
#if GTEST_OS_WINDOWS_MOBILE
return
"
\\
temp
\\
"
;
#elif GTEST_OS_WINDOWS
...
...
googletest/test/gtest_env_var_test_.cc
View file @
0d6a674f
...
...
@@ -35,6 +35,7 @@
#include "gtest/gtest.h"
#include <iostream>
#include "src/gtest-internal-inl.h"
using
::
std
::
cout
;
...
...
googletest/test/gtest_main_unittest.cc
View file @
0d6a674f
...
...
@@ -41,5 +41,5 @@ TEST(GTestMainTest, ShouldSucceed) {
}
// namespace
// We are using the main() function defined in
src/
gtest_main.cc, so
//
we
don't define it here.
// We are using the main() function defined in gtest_main.cc, so
we
// don't define it here.
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