Merge pull request #1096 from gennadiycivil/add-ability-for-custom-temdir-1093

Changes add ability to overwrite TempDir(), issue https://github.com/
This commit is contained in:
Billy Donahue 2017-05-18 16:19:58 -04:00 committed by GitHub
commit 59c795ce08
2 changed files with 7 additions and 1 deletions

View File

@ -33,6 +33,10 @@
// GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of // GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of
// OsStackTraceGetterInterface. // OsStackTraceGetterInterface.
// //
// GTEST_CUSTOM_TEMPDIR_FUNCTION_ - An override for testing::TempDir().
// See testing::TempDir for semantics and
// signature.
//
// ** Custom implementation starts here ** // ** Custom implementation starts here **
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_

View File

@ -5385,6 +5385,9 @@ void InitGoogleTest(int* argc, wchar_t** argv) {
} }
std::string TempDir() { std::string TempDir() {
#if defined(GTEST_CUSTOM_TEMPDIR_FUNCTION_)
return GTEST_CUSTOM_TEMPDIR_FUNCTION_();
#endif
#if GTEST_OS_WINDOWS_MOBILE #if GTEST_OS_WINDOWS_MOBILE
return "\\temp\\"; return "\\temp\\";
#elif GTEST_OS_WINDOWS #elif GTEST_OS_WINDOWS
@ -5402,5 +5405,4 @@ std::string TempDir() {
#endif // GTEST_OS_WINDOWS_MOBILE #endif // GTEST_OS_WINDOWS_MOBILE
} }
} // namespace testing } // namespace testing