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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user