diff options
author | Gennadiy Civil <misterg@google.com> | 2018-03-05 20:53:36 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2018-03-05 20:53:36 (GMT) |
commit | 89d6f70f34a2bbde33158e1065d964222a7c296c (patch) | |
tree | 2df33ca9cea3c507e6aed9ac4b6d15160d3fb685 /googletest/src/gtest-port.cc | |
parent | 617e2c5615780b1dd4a54c470d01ccb8de68e318 (diff) | |
download | googletest-89d6f70f34a2bbde33158e1065d964222a7c296c.zip googletest-89d6f70f34a2bbde33158e1065d964222a7c296c.tar.gz googletest-89d6f70f34a2bbde33158e1065d964222a7c296c.tar.bz2 |
merges-8refs/pull/1493/head
Diffstat (limited to 'googletest/src/gtest-port.cc')
-rw-r--r-- | googletest/src/gtest-port.cc | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index af0d120..99791f9 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -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 |