From 79e11d7c7d17e6f893467656815a79d8e84dd7c3 Mon Sep 17 00:00:00 2001 From: vladlosev Date: Fri, 5 Mar 2010 22:17:25 +0000 Subject: [PATCH] Adds a smoketest for ThreadWithParam. --- test/gtest-port_test.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc index 1588bd46..577f6099 100644 --- a/test/gtest-port_test.cc +++ b/test/gtest-port_test.cc @@ -795,6 +795,16 @@ TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) { } #if GTEST_IS_THREADSAFE + +void AddTwo(int* param) { *param += 2; } + +TEST(ThreadWithParamTest, ConstructorExecutesThreadFunc) { + int i = 40; + ThreadWithParam thread(&AddTwo, &i, NULL); + thread.Join(); + EXPECT_EQ(42, i); +} + TEST(MutexDeathTest, AssertHeldShouldAssertWhenNotLocked) { // AssertHeld() is flaky only in the presence of multiple threads accessing // the lock. In this case, the test is robust.