merges-8
This commit is contained in:
parent
617e2c5615
commit
89d6f70f34
@ -1537,14 +1537,18 @@ GTEST_API_ size_t GetFileSize(FILE* file);
|
|||||||
GTEST_API_ std::string ReadEntireFile(FILE* file);
|
GTEST_API_ std::string ReadEntireFile(FILE* file);
|
||||||
|
|
||||||
// All command line arguments.
|
// 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
|
#if GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
const ::std::vector<testing::internal::string>& GetInjectableArgvs();
|
std::vector<std::string> GetInjectableArgvs();
|
||||||
void SetInjectableArgvs(const ::std::vector<testing::internal::string>*
|
// Deprecated: pass the args vector by value instead.
|
||||||
new_argvs);
|
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
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
@ -1081,22 +1081,36 @@ std::string ReadEntireFile(FILE* file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#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 =
|
std::vector<std::string> GetInjectableArgvs() {
|
||||||
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() {
|
|
||||||
if (g_injected_test_argvs != NULL) {
|
if (g_injected_test_argvs != NULL) {
|
||||||
return *g_injected_test_argvs;
|
return *g_injected_test_argvs;
|
||||||
}
|
}
|
||||||
return GetArgvs();
|
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
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
|
@ -386,12 +386,15 @@ void AssertHelper::operator=(const Message& message) const {
|
|||||||
GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
|
GTEST_API_ GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
|
||||||
|
|
||||||
// A copy of all command line arguments. Set by InitGoogleTest().
|
// 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_)
|
#if defined(GTEST_CUSTOM_GET_ARGVS_)
|
||||||
return GTEST_CUSTOM_GET_ARGVS_();
|
// GTEST_CUSTOM_GET_ARGVS_() may return a container of std::string or
|
||||||
#else // defined(GTEST_CUSTOM_GET_ARGVS_)
|
// ::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;
|
return g_argvs;
|
||||||
#endif // defined(GTEST_CUSTOM_GET_ARGVS_)
|
#endif // defined(GTEST_CUSTOM_GET_ARGVS_)
|
||||||
}
|
}
|
||||||
@ -3035,7 +3038,7 @@ static void ColoredPrintf(GTestColor color, const char* fmt, ...) {
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text printed in Google Test's text output and --gunit_list_tests
|
// Text printed in Google Test's text output and --gtest_list_tests
|
||||||
// output to label the type parameter and value parameter for a test.
|
// output to label the type parameter and value parameter for a test.
|
||||||
static const char kTypeParamLabel[] = "TypeParam";
|
static const char kTypeParamLabel[] = "TypeParam";
|
||||||
static const char kValueParamLabel[] = "GetParam()";
|
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
|
// On success, stores the value of the flag in *value, and returns
|
||||||
// true. On failure, returns false without changing *value.
|
// true. On failure, returns false without changing *value.
|
||||||
static bool ParseStringFlag(const char* str,
|
template <typename String>
|
||||||
const char* flag,
|
static bool ParseStringFlag(const char* str, const char* flag, String* value) {
|
||||||
std::string* value) {
|
|
||||||
// Gets the value of the flag as a string.
|
// Gets the value of the flag as a string.
|
||||||
const char* const value_str = ParseFlagValue(str, flag, false);
|
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"
|
GTEST_PATH_SEP_ "@Y|@G:@YFILE_PATH]@D\n"
|
||||||
" Generate a JSON or XML report in the given directory or with the given\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"
|
" 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"
|
" @G--" GTEST_FLAG_PREFIX_ "stream_result_to=@YHOST@G:@YPORT@D\n"
|
||||||
" Stream test results to the given server.\n"
|
" Stream test results to the given server.\n"
|
||||||
#endif // GTEST_CAN_STREAM_RESULTS_
|
# endif // GTEST_CAN_STREAM_RESULTS_
|
||||||
"\n"
|
"\n"
|
||||||
"Assertion Behavior:\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"
|
" @G--" GTEST_FLAG_PREFIX_ "death_test_style=@Y(@Gfast@Y|@Gthreadsafe@Y)@D\n"
|
||||||
" Set the default death test style.\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"
|
" @G--" GTEST_FLAG_PREFIX_ "break_on_failure@D\n"
|
||||||
" Turn assertion failures into debugger break-points.\n"
|
" Turn assertion failures into debugger break-points.\n"
|
||||||
" @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n"
|
" @G--" GTEST_FLAG_PREFIX_ "throw_on_failure@D\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user