diff options
author | jgm <jgm@google.com> | 2012-11-15 15:47:38 (GMT) |
---|---|---|
committer | jgm <jgm@google.com> | 2012-11-15 15:47:38 (GMT) |
commit | 87fdda2cf24d953f3cbec1e0c266b2db9928f406 (patch) | |
tree | 640cd727bab672105c57f563091dc58b7a81a1be /test/gtest-port_test.cc | |
parent | 78bf6d5724e733cce313228856e18d5c372b4fb3 (diff) | |
download | googletest-87fdda2cf24d953f3cbec1e0c266b2db9928f406.zip googletest-87fdda2cf24d953f3cbec1e0c266b2db9928f406.tar.gz googletest-87fdda2cf24d953f3cbec1e0c266b2db9928f406.tar.bz2 |
Unfortunately, the svn repo is a bit out of date. This commit contains 8
changes that haven't made it to svn. The descriptions of each change are listed
below.
- Fixes some python shebang lines.
- Add ElementsAreArray overloads to gmock. ElementsAreArray now makes a copy of
its input elements before the conversion to a Matcher. ElementsAreArray can
now take a vector as input. ElementsAreArray can now take an iterator pair as
input.
- Templatize MatchAndExplain to allow independent string types for the matcher
and matchee. I also templatized the ConstCharPointer version of
MatchAndExplain to avoid calls with "char*" from using the new templated
MatchAndExplain.
- Fixes the bug where the constructor of the return type of ElementsAre() saves
a reference instead of a copy of the arguments.
- Extends ElementsAre() to accept arrays whose sizes aren't known.
- Switches gTest's internal FilePath class from testing::internal::String to
std::string. testing::internal::String was introduced when gTest couldn't
depend on std::string. It's now deprecated.
- Switches gTest & gMock from using testing::internal::String objects to
std::string. Some static methods of String are still in use. We may be able
to remove some but not all of them. In particular, String::Format() should
eventually be removed as it truncates the result at 4096 characters, often
causing problems.
Diffstat (limited to 'test/gtest-port_test.cc')
-rw-r--r-- | test/gtest-port_test.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc index dfbf029..43f1f20 100644 --- a/test/gtest-port_test.cc +++ b/test/gtest-port_test.cc @@ -1005,7 +1005,7 @@ TEST(ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion) { } TEST(ThreadLocalTest, GetAndPointerReturnSameValue) { - ThreadLocal<String> thread_local_string; + ThreadLocal<std::string> thread_local_string; EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get())); @@ -1015,8 +1015,9 @@ TEST(ThreadLocalTest, GetAndPointerReturnSameValue) { } TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) { - ThreadLocal<String> thread_local_string; - const ThreadLocal<String>& const_thread_local_string = thread_local_string; + ThreadLocal<std::string> thread_local_string; + const ThreadLocal<std::string>& const_thread_local_string = + thread_local_string; EXPECT_EQ(thread_local_string.pointer(), const_thread_local_string.pointer()); @@ -1126,18 +1127,19 @@ void RunFromThread(void (func)(T), T param) { thread.Join(); } -void RetrieveThreadLocalValue(pair<ThreadLocal<String>*, String*> param) { +void RetrieveThreadLocalValue( + pair<ThreadLocal<std::string>*, std::string*> param) { *param.second = param.first->get(); } TEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) { - ThreadLocal<String> thread_local_string("foo"); + ThreadLocal<std::string> thread_local_string("foo"); EXPECT_STREQ("foo", thread_local_string.get().c_str()); thread_local_string.set("bar"); EXPECT_STREQ("bar", thread_local_string.get().c_str()); - String result; + std::string result; RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local_string, &result)); EXPECT_STREQ("foo", result.c_str()); @@ -1235,14 +1237,14 @@ TEST(ThreadLocalTest, DestroysManagedObjectAtThreadExit) { } TEST(ThreadLocalTest, ThreadLocalMutationsAffectOnlyCurrentThread) { - ThreadLocal<String> thread_local_string; + ThreadLocal<std::string> thread_local_string; thread_local_string.set("Foo"); EXPECT_STREQ("Foo", thread_local_string.get().c_str()); - String result; + std::string result; RunFromThread(&RetrieveThreadLocalValue, make_pair(&thread_local_string, &result)); - EXPECT_TRUE(result.c_str() == NULL); + EXPECT_TRUE(result.empty()); } #endif // GTEST_IS_THREADSAFE |