Condition some code on !GTEST_HAS_MUTEX_AND_THREAD_LOCAL_

This commit is contained in:
kosak 2015-07-19 22:05:06 +00:00
parent 4d69b1607a
commit 7d7beaa155

View File

@ -1149,6 +1149,13 @@ TEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) {
EXPECT_STREQ("foo", result.c_str()); EXPECT_STREQ("foo", result.c_str());
} }
# if !GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
// Tests in this section depend on that Google Test's own ThreadLocal
// implementation stores a copy of the default value shared by all
// threads. We don't want to test this for an external implementation received
// through GTEST_HAS_MUTEX_AND_THREAD_LOCAL_.
// Keeps track of whether of destructors being called on instances of // Keeps track of whether of destructors being called on instances of
// DestructorTracker. On Windows, waits for the destructor call reports. // DestructorTracker. On Windows, waits for the destructor call reports.
class DestructorCall { class DestructorCall {
@ -1289,6 +1296,8 @@ TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) {
DestructorCall::ResetList(); DestructorCall::ResetList();
} }
# endif // !GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
TEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) { TEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) {
ThreadLocal<std::string> thread_local_string; ThreadLocal<std::string> thread_local_string;
thread_local_string.set("Foo"); thread_local_string.set("Foo");