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
89d6f70f
Commit
89d6f70f
authored
Mar 05, 2018
by
Gennadiy Civil
Browse files
merges-8
parent
617e2c56
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
27 deletions
+47
-27
googletest/include/gtest/internal/gtest-port.h
googletest/include/gtest/internal/gtest-port.h
+9
-5
googletest/src/gtest-port.cc
googletest/src/gtest-port.cc
+24
-10
googletest/src/gtest.cc
googletest/src/gtest.cc
+14
-12
No files found.
googletest/include/gtest/internal/gtest-port.h
View file @
89d6f70f
...
...
@@ -1537,14 +1537,18 @@ GTEST_API_ size_t GetFileSize(FILE* file);
GTEST_API_
std
::
string
ReadEntireFile
(
FILE
*
file
);
// All command line arguments.
GTEST_API_
const
::
std
::
vector
<
testing
::
internal
::
string
>
&
GetArgvs
();
GTEST_API_
std
::
vector
<
std
::
string
>
GetArgvs
();
#if GTEST_HAS_DEATH_TEST
const
::
std
::
vector
<
testing
::
internal
::
string
>&
GetInjectableArgvs
();
void
SetInjectableArgvs
(
const
::
std
::
vector
<
testing
::
internal
::
string
>*
new_argvs
);
std
::
vector
<
std
::
string
>
GetInjectableArgvs
();
// Deprecated: pass the args vector by value instead.
void
SetInjectableArgvs
(
const
std
::
vector
<
std
::
string
>*
new_argvs
);
void
SetInjectableArgvs
(
const
std
::
vector
<
std
::
string
>&
new_argvs
);
#if GTEST_HAS_GLOBAL_STRING
void
SetInjectableArgvs
(
const
std
::
vector
<
::
string
>&
new_argvs
);
#endif // GTEST_HAS_GLOBAL_STRING
void
ClearInjectableArgvs
();
#endif // GTEST_HAS_DEATH_TEST
...
...
googletest/src/gtest-port.cc
View file @
89d6f70f
...
...
@@ -1081,22 +1081,36 @@ std::string ReadEntireFile(FILE* file) {
}
#if GTEST_HAS_DEATH_TEST
static
const
std
::
vector
<
std
::
string
>*
g_injected_test_argvs
=
NULL
;
// Owned.
static
const
::
std
::
vector
<
testing
::
internal
::
string
>*
g_injected_test_argvs
=
NULL
;
// Owned.
void
SetInjectableArgvs
(
const
::
std
::
vector
<
testing
::
internal
::
string
>*
argvs
)
{
if
(
g_injected_test_argvs
!=
argvs
)
delete
g_injected_test_argvs
;
g_injected_test_argvs
=
argvs
;
}
const
::
std
::
vector
<
testing
::
internal
::
string
>&
GetInjectableArgvs
()
{
std
::
vector
<
std
::
string
>
GetInjectableArgvs
()
{
if
(
g_injected_test_argvs
!=
NULL
)
{
return
*
g_injected_test_argvs
;
}
return
GetArgvs
();
}
void
SetInjectableArgvs
(
const
std
::
vector
<
std
::
string
>*
new_argvs
)
{
if
(
g_injected_test_argvs
!=
new_argvs
)
delete
g_injected_test_argvs
;
g_injected_test_argvs
=
new_argvs
;
}
void
SetInjectableArgvs
(
const
std
::
vector
<
std
::
string
>&
new_argvs
)
{
SetInjectableArgvs
(
new
std
::
vector
<
std
::
string
>
(
new_argvs
.
begin
(),
new_argvs
.
end
()));
}
#if GTEST_HAS_GLOBAL_STRING
void
SetInjectableArgvs
(
const
std
::
vector
<
::
string
>&
new_argvs
)
{
SetInjectableArgvs
(
new
std
::
vector
<
std
::
string
>
(
new_argvs
.
begin
(),
new_argvs
.
end
()));
}
#endif // GTEST_HAS_GLOBAL_STRING
void
ClearInjectableArgvs
()
{
delete
g_injected_test_argvs
;
g_injected_test_argvs
=
NULL
;
}
#endif // GTEST_HAS_DEATH_TEST
#if GTEST_OS_WINDOWS_MOBILE
...
...
googletest/src/gtest.cc
View file @
89d6f70f
...
...
@@ -386,12 +386,15 @@ void AssertHelper::operator=(const Message& message) const {
GTEST_API_
GTEST_DEFINE_STATIC_MUTEX_
(
g_linked_ptr_mutex
);
// A copy of all command line arguments. Set by InitGoogleTest().
::
std
::
vector
<
testing
::
internal
::
string
>
g_argvs
;
::
std
::
vector
<
std
::
string
>
g_argvs
;
const
::
std
::
vector
<
testing
::
internal
::
string
>
&
GetArgvs
()
{
::
std
::
vector
<
std
::
string
>
GetArgvs
()
{
#if defined(GTEST_CUSTOM_GET_ARGVS_)
return
GTEST_CUSTOM_GET_ARGVS_
();
#else // defined(GTEST_CUSTOM_GET_ARGVS_)
// GTEST_CUSTOM_GET_ARGVS_() may return a container of std::string or
// ::string. This code converts it to the appropriate type.
const
auto
&
custom
=
GTEST_CUSTOM_GET_ARGVS_
();
return
::
std
::
vector
<
std
::
string
>
(
custom
.
begin
(),
custom
.
end
());
#else // defined(GTEST_CUSTOM_GET_ARGVS_)
return
g_argvs
;
#endif // defined(GTEST_CUSTOM_GET_ARGVS_)
}
...
...
@@ -3035,7 +3038,7 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
va_end
(
args
);
}
// Text printed in Google Test's text output and --g
uni
t_list_tests
// Text printed in Google Test's text output and --g
tes
t_list_tests
// output to label the type parameter and value parameter for a test.
static
const
char
kTypeParamLabel
[]
=
"TypeParam"
;
static
const
char
kValueParamLabel
[]
=
"GetParam()"
;
...
...
@@ -5449,9 +5452,8 @@ bool ParseInt32Flag(const char* str, const char* flag, Int32* value) {
//
// On success, stores the value of the flag in *value, and returns
// true. On failure, returns false without changing *value.
static
bool
ParseStringFlag
(
const
char
*
str
,
const
char
*
flag
,
std
::
string
*
value
)
{
template
<
typename
String
>
static
bool
ParseStringFlag
(
const
char
*
str
,
const
char
*
flag
,
String
*
value
)
{
// Gets the value of the flag as a string.
const
char
*
const
value_str
=
ParseFlagValue
(
str
,
flag
,
false
);
...
...
@@ -5557,16 +5559,16 @@ static const char kColorEncodedHelpMessage[] =
GTEST_PATH_SEP_
"@Y|@G:@YFILE_PATH]@D
\n
"
" Generate a JSON or XML report in the given directory or with the given
\n
"
" file name. @YFILE_PATH@D defaults to @Gtest_details.xml@D.
\n
"
#if GTEST_CAN_STREAM_RESULTS_
#
if GTEST_CAN_STREAM_RESULTS_
" @G--"
GTEST_FLAG_PREFIX_
"stream_result_to=@YHOST@G:@YPORT@D
\n
"
" Stream test results to the given server.
\n
"
#endif // GTEST_CAN_STREAM_RESULTS_
#
endif // GTEST_CAN_STREAM_RESULTS_
"
\n
"
"Assertion Behavior:
\n
"
#if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
#
if GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
" @G--"
GTEST_FLAG_PREFIX_
"death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D
\n
"
" Set the default death test style.
\n
"
#endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
#
endif // GTEST_HAS_DEATH_TEST && !GTEST_OS_WINDOWS
" @G--"
GTEST_FLAG_PREFIX_
"break_on_failure@D
\n
"
" Turn assertion failures into debugger break-points.
\n
"
" @G--"
GTEST_FLAG_PREFIX_
"throw_on_failure@D
\n
"
...
...
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