From 03c314931649a999b0cf5deb0a434a1009157416 Mon Sep 17 00:00:00 2001 From: "jgm@google.com" Date: Thu, 15 Nov 2012 15:47:38 +0000 Subject: 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. git-svn-id: http://googletest.googlecode.com/svn/trunk@628 861a406c-534a-0410-8894-cb66d6ee9925 --- test/gtest-death-test_test.cc | 26 ++- test/gtest-filepath_test.cc | 256 ++++++++++++++---------------- test/gtest-listener_test.cc | 31 ++-- test/gtest-message_test.cc | 55 +++---- test/gtest-options_test.cc | 57 +++---- test/gtest-param-test_test.cc | 4 +- test/gtest-port_test.cc | 20 +-- test/gtest_output_test_.cc | 4 +- test/gtest_shuffle_test_.cc | 1 - test/gtest_stress_test.cc | 5 +- test/gtest_unittest.cc | 359 ++++-------------------------------------- 11 files changed, 247 insertions(+), 571 deletions(-) (limited to 'test') diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc index b389e73..e42c013 100644 --- a/test/gtest-death-test_test.cc +++ b/test/gtest-death-test_test.cc @@ -77,7 +77,6 @@ using testing::internal::GetLastErrnoDescription; using testing::internal::GetUnitTestImpl; using testing::internal::InDeathTestChild; using testing::internal::ParseNaturalNumber; -using testing::internal::String; namespace testing { namespace internal { @@ -1139,26 +1138,26 @@ TEST(ParseNaturalNumberTest, RejectsInvalidFormat) { BiggestParsable result = 0; // Rejects non-numbers. - EXPECT_FALSE(ParseNaturalNumber(String("non-number string"), &result)); + EXPECT_FALSE(ParseNaturalNumber("non-number string", &result)); // Rejects numbers with whitespace prefix. - EXPECT_FALSE(ParseNaturalNumber(String(" 123"), &result)); + EXPECT_FALSE(ParseNaturalNumber(" 123", &result)); // Rejects negative numbers. - EXPECT_FALSE(ParseNaturalNumber(String("-123"), &result)); + EXPECT_FALSE(ParseNaturalNumber("-123", &result)); // Rejects numbers starting with a plus sign. - EXPECT_FALSE(ParseNaturalNumber(String("+123"), &result)); + EXPECT_FALSE(ParseNaturalNumber("+123", &result)); errno = 0; } TEST(ParseNaturalNumberTest, RejectsOverflownNumbers) { BiggestParsable result = 0; - EXPECT_FALSE(ParseNaturalNumber(String("99999999999999999999999"), &result)); + EXPECT_FALSE(ParseNaturalNumber("99999999999999999999999", &result)); signed char char_result = 0; - EXPECT_FALSE(ParseNaturalNumber(String("200"), &char_result)); + EXPECT_FALSE(ParseNaturalNumber("200", &char_result)); errno = 0; } @@ -1166,16 +1165,16 @@ TEST(ParseNaturalNumberTest, AcceptsValidNumbers) { BiggestParsable result = 0; result = 0; - ASSERT_TRUE(ParseNaturalNumber(String("123"), &result)); + ASSERT_TRUE(ParseNaturalNumber("123", &result)); EXPECT_EQ(123U, result); // Check 0 as an edge case. result = 1; - ASSERT_TRUE(ParseNaturalNumber(String("0"), &result)); + ASSERT_TRUE(ParseNaturalNumber("0", &result)); EXPECT_EQ(0U, result); result = 1; - ASSERT_TRUE(ParseNaturalNumber(String("00000"), &result)); + ASSERT_TRUE(ParseNaturalNumber("00000", &result)); EXPECT_EQ(0U, result); } @@ -1211,11 +1210,11 @@ TEST(ParseNaturalNumberTest, AcceptsTypeLimits) { TEST(ParseNaturalNumberTest, WorksForShorterIntegers) { short short_result = 0; - ASSERT_TRUE(ParseNaturalNumber(String("123"), &short_result)); + ASSERT_TRUE(ParseNaturalNumber("123", &short_result)); EXPECT_EQ(123, short_result); signed char char_result = 0; - ASSERT_TRUE(ParseNaturalNumber(String("123"), &char_result)); + ASSERT_TRUE(ParseNaturalNumber("123", &char_result)); EXPECT_EQ(123, char_result); } @@ -1245,7 +1244,6 @@ TEST(ConditionalDeathMacrosDeathTest, ExpectsDeathWhenDeathTestsAvailable) { using testing::internal::CaptureStderr; using testing::internal::GetCapturedStderr; -using testing::internal::String; // Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED are still // defined but do not trigger failures when death tests are not available on @@ -1255,7 +1253,7 @@ TEST(ConditionalDeathMacrosTest, WarnsWhenDeathTestsNotAvailable) { // when death tests are not supported. CaptureStderr(); EXPECT_DEATH_IF_SUPPORTED(;, ""); - String output = GetCapturedStderr(); + std::string output = GetCapturedStderr(); ASSERT_TRUE(NULL != strstr(output.c_str(), "Death tests are not supported on this platform")); ASSERT_TRUE(NULL != strstr(output.c_str(), ";")); diff --git a/test/gtest-filepath_test.cc b/test/gtest-filepath_test.cc index 3196ea0..ae9f55a 100644 --- a/test/gtest-filepath_test.cc +++ b/test/gtest-filepath_test.cc @@ -100,7 +100,7 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) { # else - EXPECT_STREQ(GTEST_PATH_SEP_, cwd.c_str()); + EXPECT_EQ(GTEST_PATH_SEP_, cwd.string()); # endif } @@ -109,7 +109,6 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) { TEST(IsEmptyTest, ReturnsTrueForEmptyPath) { EXPECT_TRUE(FilePath("").IsEmpty()); - EXPECT_TRUE(FilePath(NULL).IsEmpty()); } TEST(IsEmptyTest, ReturnsFalseForNonEmptyPath) { @@ -121,38 +120,38 @@ TEST(IsEmptyTest, ReturnsFalseForNonEmptyPath) { // RemoveDirectoryName "" -> "" TEST(RemoveDirectoryNameTest, WhenEmptyName) { - EXPECT_STREQ("", FilePath("").RemoveDirectoryName().c_str()); + EXPECT_EQ("", FilePath("").RemoveDirectoryName().string()); } // RemoveDirectoryName "afile" -> "afile" TEST(RemoveDirectoryNameTest, ButNoDirectory) { - EXPECT_STREQ("afile", - FilePath("afile").RemoveDirectoryName().c_str()); + EXPECT_EQ("afile", + FilePath("afile").RemoveDirectoryName().string()); } // RemoveDirectoryName "/afile" -> "afile" TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) { - EXPECT_STREQ("afile", - FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str()); + EXPECT_EQ("afile", + FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().string()); } // RemoveDirectoryName "adir/" -> "" TEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) { - EXPECT_STREQ("", - FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().c_str()); + EXPECT_EQ("", + FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().string()); } // RemoveDirectoryName "adir/afile" -> "afile" TEST(RemoveDirectoryNameTest, ShouldGiveFileName) { - EXPECT_STREQ("afile", - FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str()); + EXPECT_EQ("afile", + FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().string()); } // RemoveDirectoryName "adir/subdir/afile" -> "afile" TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) { - EXPECT_STREQ("afile", + EXPECT_EQ("afile", FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile") - .RemoveDirectoryName().c_str()); + .RemoveDirectoryName().string()); } #if GTEST_HAS_ALT_PATH_SEP_ @@ -162,26 +161,23 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) { // RemoveDirectoryName("/afile") -> "afile" TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileNameForAlternateSeparator) { - EXPECT_STREQ("afile", - FilePath("/afile").RemoveDirectoryName().c_str()); + EXPECT_EQ("afile", FilePath("/afile").RemoveDirectoryName().string()); } // RemoveDirectoryName("adir/") -> "" TEST(RemoveDirectoryNameTest, WhereThereIsNoFileNameForAlternateSeparator) { - EXPECT_STREQ("", - FilePath("adir/").RemoveDirectoryName().c_str()); + EXPECT_EQ("", FilePath("adir/").RemoveDirectoryName().string()); } // RemoveDirectoryName("adir/afile") -> "afile" TEST(RemoveDirectoryNameTest, ShouldGiveFileNameForAlternateSeparator) { - EXPECT_STREQ("afile", - FilePath("adir/afile").RemoveDirectoryName().c_str()); + EXPECT_EQ("afile", FilePath("adir/afile").RemoveDirectoryName().string()); } // RemoveDirectoryName("adir/subdir/afile") -> "afile" TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) { - EXPECT_STREQ("afile", - FilePath("adir/subdir/afile").RemoveDirectoryName().c_str()); + EXPECT_EQ("afile", + FilePath("adir/subdir/afile").RemoveDirectoryName().string()); } #endif @@ -190,38 +186,35 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileNameForAlternateSeparator) { TEST(RemoveFileNameTest, EmptyName) { #if GTEST_OS_WINDOWS_MOBILE // On Windows CE, we use the root as the current directory. - EXPECT_STREQ(GTEST_PATH_SEP_, - FilePath("").RemoveFileName().c_str()); + EXPECT_EQ(GTEST_PATH_SEP_, FilePath("").RemoveFileName().string()); #else - EXPECT_STREQ("." GTEST_PATH_SEP_, - FilePath("").RemoveFileName().c_str()); + EXPECT_EQ("." GTEST_PATH_SEP_, FilePath("").RemoveFileName().string()); #endif } // RemoveFileName "adir/" -> "adir/" TEST(RemoveFileNameTest, ButNoFile) { - EXPECT_STREQ("adir" GTEST_PATH_SEP_, - FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().c_str()); + EXPECT_EQ("adir" GTEST_PATH_SEP_, + FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().string()); } // RemoveFileName "adir/afile" -> "adir/" TEST(RemoveFileNameTest, GivesDirName) { - EXPECT_STREQ("adir" GTEST_PATH_SEP_, - FilePath("adir" GTEST_PATH_SEP_ "afile") - .RemoveFileName().c_str()); + EXPECT_EQ("adir" GTEST_PATH_SEP_, + FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveFileName().string()); } // RemoveFileName "adir/subdir/afile" -> "adir/subdir/" TEST(RemoveFileNameTest, GivesDirAndSubDirName) { - EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_, + EXPECT_EQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_, FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile") - .RemoveFileName().c_str()); + .RemoveFileName().string()); } // RemoveFileName "/afile" -> "/" TEST(RemoveFileNameTest, GivesRootDir) { - EXPECT_STREQ(GTEST_PATH_SEP_, - FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().c_str()); + EXPECT_EQ(GTEST_PATH_SEP_, + FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().string()); } #if GTEST_HAS_ALT_PATH_SEP_ @@ -231,26 +224,25 @@ TEST(RemoveFileNameTest, GivesRootDir) { // RemoveFileName("adir/") -> "adir/" TEST(RemoveFileNameTest, ButNoFileForAlternateSeparator) { - EXPECT_STREQ("adir" GTEST_PATH_SEP_, - FilePath("adir/").RemoveFileName().c_str()); + EXPECT_EQ("adir" GTEST_PATH_SEP_, + FilePath("adir/").RemoveFileName().string()); } // RemoveFileName("adir/afile") -> "adir/" TEST(RemoveFileNameTest, GivesDirNameForAlternateSeparator) { - EXPECT_STREQ("adir" GTEST_PATH_SEP_, - FilePath("adir/afile").RemoveFileName().c_str()); + EXPECT_EQ("adir" GTEST_PATH_SEP_, + FilePath("adir/afile").RemoveFileName().string()); } // RemoveFileName("adir/subdir/afile") -> "adir/subdir/" TEST(RemoveFileNameTest, GivesDirAndSubDirNameForAlternateSeparator) { - EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_, - FilePath("adir/subdir/afile").RemoveFileName().c_str()); + EXPECT_EQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_, + FilePath("adir/subdir/afile").RemoveFileName().string()); } // RemoveFileName("/afile") -> "\" TEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) { - EXPECT_STREQ(GTEST_PATH_SEP_, - FilePath("/afile").RemoveFileName().c_str()); + EXPECT_EQ(GTEST_PATH_SEP_, FilePath("/afile").RemoveFileName().string()); } #endif @@ -258,125 +250,120 @@ TEST(RemoveFileNameTest, GivesRootDirForAlternateSeparator) { TEST(MakeFileNameTest, GenerateWhenNumberIsZero) { FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"), 0, "xml"); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string()); } TEST(MakeFileNameTest, GenerateFileNameNumberGtZero) { FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"), 12, "xml"); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.string()); } TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) { FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_), FilePath("bar"), 0, "xml"); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string()); } TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) { FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_), FilePath("bar"), 12, "xml"); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.string()); } TEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) { FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"), 0, "xml"); - EXPECT_STREQ("bar.xml", actual.c_str()); + EXPECT_EQ("bar.xml", actual.string()); } TEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) { FilePath actual = FilePath::MakeFileName(FilePath(""), FilePath("bar"), 14, "xml"); - EXPECT_STREQ("bar_14.xml", actual.c_str()); + EXPECT_EQ("bar_14.xml", actual.string()); } TEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) { FilePath actual = FilePath::ConcatPaths(FilePath("foo"), FilePath("bar.xml")); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string()); } TEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) { FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_), FilePath("bar.xml")); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.string()); } TEST(ConcatPathsTest, Path1BeingEmpty) { FilePath actual = FilePath::ConcatPaths(FilePath(""), FilePath("bar.xml")); - EXPECT_STREQ("bar.xml", actual.c_str()); + EXPECT_EQ("bar.xml", actual.string()); } TEST(ConcatPathsTest, Path2BeingEmpty) { - FilePath actual = FilePath::ConcatPaths(FilePath("foo"), - FilePath("")); - EXPECT_STREQ("foo" GTEST_PATH_SEP_, actual.c_str()); + FilePath actual = FilePath::ConcatPaths(FilePath("foo"), FilePath("")); + EXPECT_EQ("foo" GTEST_PATH_SEP_, actual.string()); } TEST(ConcatPathsTest, BothPathBeingEmpty) { FilePath actual = FilePath::ConcatPaths(FilePath(""), FilePath("")); - EXPECT_STREQ("", actual.c_str()); + EXPECT_EQ("", actual.string()); } TEST(ConcatPathsTest, Path1ContainsPathSep) { FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_ "bar"), FilePath("foobar.xml")); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml", - actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml", + actual.string()); } TEST(ConcatPathsTest, Path2ContainsPathSep) { FilePath actual = FilePath::ConcatPaths( FilePath("foo" GTEST_PATH_SEP_), FilePath("bar" GTEST_PATH_SEP_ "bar.xml")); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml", - actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml", + actual.string()); } TEST(ConcatPathsTest, Path2EndsWithPathSep) { FilePath actual = FilePath::ConcatPaths(FilePath("foo"), FilePath("bar" GTEST_PATH_SEP_)); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.string()); } // RemoveTrailingPathSeparator "" -> "" TEST(RemoveTrailingPathSeparatorTest, EmptyString) { - EXPECT_STREQ("", - FilePath("").RemoveTrailingPathSeparator().c_str()); + EXPECT_EQ("", FilePath("").RemoveTrailingPathSeparator().string()); } // RemoveTrailingPathSeparator "foo" -> "foo" TEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) { - EXPECT_STREQ("foo", - FilePath("foo").RemoveTrailingPathSeparator().c_str()); + EXPECT_EQ("foo", FilePath("foo").RemoveTrailingPathSeparator().string()); } // RemoveTrailingPathSeparator "foo/" -> "foo" TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) { - EXPECT_STREQ( - "foo", - FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str()); + EXPECT_EQ("foo", + FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().string()); #if GTEST_HAS_ALT_PATH_SEP_ - EXPECT_STREQ("foo", - FilePath("foo/").RemoveTrailingPathSeparator().c_str()); + EXPECT_EQ("foo", FilePath("foo/").RemoveTrailingPathSeparator().string()); #endif } // RemoveTrailingPathSeparator "foo/bar/" -> "foo/bar/" TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) { - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar", - FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_) - .RemoveTrailingPathSeparator().c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar", + FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_) + .RemoveTrailingPathSeparator().string()); } // RemoveTrailingPathSeparator "foo/bar" -> "foo/bar" TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) { - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar", - FilePath("foo" GTEST_PATH_SEP_ "bar") - .RemoveTrailingPathSeparator().c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar", + FilePath("foo" GTEST_PATH_SEP_ "bar") + .RemoveTrailingPathSeparator().string()); } TEST(DirectoryTest, RootDirectoryExists) { @@ -431,40 +418,35 @@ TEST(DirectoryTest, CurrentDirectoryExists) { #endif // GTEST_OS_WINDOWS } -TEST(NormalizeTest, NullStringsEqualEmptyDirectory) { - EXPECT_STREQ("", FilePath(NULL).c_str()); - EXPECT_STREQ("", FilePath(String(NULL)).c_str()); -} - // "foo/bar" == foo//bar" == "foo///bar" TEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) { - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar", - FilePath("foo" GTEST_PATH_SEP_ "bar").c_str()); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar", - FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str()); - EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar", - FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ - GTEST_PATH_SEP_ "bar").c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar", + FilePath("foo" GTEST_PATH_SEP_ "bar").string()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar", + FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string()); + EXPECT_EQ("foo" GTEST_PATH_SEP_ "bar", + FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ + GTEST_PATH_SEP_ "bar").string()); } // "/bar" == //bar" == "///bar" TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) { - EXPECT_STREQ(GTEST_PATH_SEP_ "bar", - FilePath(GTEST_PATH_SEP_ "bar").c_str()); - EXPECT_STREQ(GTEST_PATH_SEP_ "bar", - FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str()); - EXPECT_STREQ(GTEST_PATH_SEP_ "bar", - FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str()); + EXPECT_EQ(GTEST_PATH_SEP_ "bar", + FilePath(GTEST_PATH_SEP_ "bar").string()); + EXPECT_EQ(GTEST_PATH_SEP_ "bar", + FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string()); + EXPECT_EQ(GTEST_PATH_SEP_ "bar", + FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").string()); } // "foo/" == foo//" == "foo///" TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) { - EXPECT_STREQ("foo" GTEST_PATH_SEP_, - FilePath("foo" GTEST_PATH_SEP_).c_str()); - EXPECT_STREQ("foo" GTEST_PATH_SEP_, - FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str()); - EXPECT_STREQ("foo" GTEST_PATH_SEP_, - FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_, + FilePath("foo" GTEST_PATH_SEP_).string()); + EXPECT_EQ("foo" GTEST_PATH_SEP_, + FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).string()); + EXPECT_EQ("foo" GTEST_PATH_SEP_, + FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).string()); } #if GTEST_HAS_ALT_PATH_SEP_ @@ -473,12 +455,12 @@ TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) { // regardless of their combination (e.g. "foo\" =="foo/\" == // "foo\\/"). TEST(NormalizeTest, MixAlternateSeparatorAtStringEnd) { - EXPECT_STREQ("foo" GTEST_PATH_SEP_, - FilePath("foo/").c_str()); - EXPECT_STREQ("foo" GTEST_PATH_SEP_, - FilePath("foo" GTEST_PATH_SEP_ "/").c_str()); - EXPECT_STREQ("foo" GTEST_PATH_SEP_, - FilePath("foo//" GTEST_PATH_SEP_).c_str()); + EXPECT_EQ("foo" GTEST_PATH_SEP_, + FilePath("foo/").string()); + EXPECT_EQ("foo" GTEST_PATH_SEP_, + FilePath("foo" GTEST_PATH_SEP_ "/").string()); + EXPECT_EQ("foo" GTEST_PATH_SEP_, + FilePath("foo//" GTEST_PATH_SEP_).string()); } #endif @@ -487,31 +469,31 @@ TEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) { FilePath default_path; FilePath non_default_path("path"); non_default_path = default_path; - EXPECT_STREQ("", non_default_path.c_str()); - EXPECT_STREQ("", default_path.c_str()); // RHS var is unchanged. + EXPECT_EQ("", non_default_path.string()); + EXPECT_EQ("", default_path.string()); // RHS var is unchanged. } TEST(AssignmentOperatorTest, NonDefaultAssignedToDefault) { FilePath non_default_path("path"); FilePath default_path; default_path = non_default_path; - EXPECT_STREQ("path", default_path.c_str()); - EXPECT_STREQ("path", non_default_path.c_str()); // RHS var is unchanged. + EXPECT_EQ("path", default_path.string()); + EXPECT_EQ("path", non_default_path.string()); // RHS var is unchanged. } TEST(AssignmentOperatorTest, ConstAssignedToNonConst) { const FilePath const_default_path("const_path"); FilePath non_default_path("path"); non_default_path = const_default_path; - EXPECT_STREQ("const_path", non_default_path.c_str()); + EXPECT_EQ("const_path", non_default_path.string()); } class DirectoryCreationTest : public Test { protected: virtual void SetUp() { - testdata_path_.Set(FilePath(String::Format("%s%s%s", - TempDir().c_str(), GetCurrentExecutableName().c_str(), - "_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_))); + testdata_path_.Set(FilePath( + TempDir() + GetCurrentExecutableName().string() + + "_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_)); testdata_file_.Set(testdata_path_.RemoveTrailingPathSeparator()); unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"), @@ -532,21 +514,21 @@ class DirectoryCreationTest : public Test { posix::RmDir(testdata_path_.c_str()); } - String TempDir() const { + std::string TempDir() const { #if GTEST_OS_WINDOWS_MOBILE - return String("\\temp\\"); + return "\\temp\\"; #elif GTEST_OS_WINDOWS const char* temp_dir = posix::GetEnv("TEMP"); if (temp_dir == NULL || temp_dir[0] == '\0') - return String("\\temp\\"); - else if (String(temp_dir).EndsWith("\\")) - return String(temp_dir); + return "\\temp\\"; + else if (temp_dir[strlen(temp_dir) - 1] == '\\') + return temp_dir; else - return String::Format("%s\\", temp_dir); + return std::string(temp_dir) + "\\"; #elif GTEST_OS_LINUX_ANDROID - return String("/sdcard/"); + return "/sdcard/"; #else - return String("/tmp/"); + return "/tmp/"; #endif // GTEST_OS_WINDOWS_MOBILE } @@ -566,13 +548,13 @@ class DirectoryCreationTest : public Test { }; TEST_F(DirectoryCreationTest, CreateDirectoriesRecursively) { - EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.c_str(); + EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.string(); EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively()); EXPECT_TRUE(testdata_path_.DirectoryExists()); } TEST_F(DirectoryCreationTest, CreateDirectoriesForAlreadyExistingPath) { - EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.c_str(); + EXPECT_FALSE(testdata_path_.DirectoryExists()) << testdata_path_.string(); EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively()); // Call 'create' again... should still succeed. EXPECT_TRUE(testdata_path_.CreateDirectoriesRecursively()); @@ -581,7 +563,7 @@ TEST_F(DirectoryCreationTest, CreateDirectoriesForAlreadyExistingPath) { TEST_F(DirectoryCreationTest, CreateDirectoriesAndUniqueFilename) { FilePath file_path(FilePath::GenerateUniqueFileName(testdata_path_, FilePath("unique"), "txt")); - EXPECT_STREQ(unique_file0_.c_str(), file_path.c_str()); + EXPECT_EQ(unique_file0_.string(), file_path.string()); EXPECT_FALSE(file_path.FileOrDirectoryExists()); // file not there testdata_path_.CreateDirectoriesRecursively(); @@ -591,7 +573,7 @@ TEST_F(DirectoryCreationTest, CreateDirectoriesAndUniqueFilename) { FilePath file_path2(FilePath::GenerateUniqueFileName(testdata_path_, FilePath("unique"), "txt")); - EXPECT_STREQ(unique_file1_.c_str(), file_path2.c_str()); + EXPECT_EQ(unique_file1_.string(), file_path2.string()); EXPECT_FALSE(file_path2.FileOrDirectoryExists()); // file not there CreateTextFile(file_path2.c_str()); EXPECT_TRUE(file_path2.FileOrDirectoryExists()); @@ -612,43 +594,43 @@ TEST(NoDirectoryCreationTest, CreateNoDirectoriesForDefaultXmlFile) { TEST(FilePathTest, DefaultConstructor) { FilePath fp; - EXPECT_STREQ("", fp.c_str()); + EXPECT_EQ("", fp.string()); } TEST(FilePathTest, CharAndCopyConstructors) { const FilePath fp("spicy"); - EXPECT_STREQ("spicy", fp.c_str()); + EXPECT_EQ("spicy", fp.string()); const FilePath fp_copy(fp); - EXPECT_STREQ("spicy", fp_copy.c_str()); + EXPECT_EQ("spicy", fp_copy.string()); } TEST(FilePathTest, StringConstructor) { - const FilePath fp(String("cider")); - EXPECT_STREQ("cider", fp.c_str()); + const FilePath fp(std::string("cider")); + EXPECT_EQ("cider", fp.string()); } TEST(FilePathTest, Set) { const FilePath apple("apple"); FilePath mac("mac"); mac.Set(apple); // Implement Set() since overloading operator= is forbidden. - EXPECT_STREQ("apple", mac.c_str()); - EXPECT_STREQ("apple", apple.c_str()); + EXPECT_EQ("apple", mac.string()); + EXPECT_EQ("apple", apple.string()); } TEST(FilePathTest, ToString) { const FilePath file("drink"); - String str(file.ToString()); - EXPECT_STREQ("drink", str.c_str()); + EXPECT_EQ("drink", file.string()); } TEST(FilePathTest, RemoveExtension) { - EXPECT_STREQ("app", FilePath("app.exe").RemoveExtension("exe").c_str()); - EXPECT_STREQ("APP", FilePath("APP.EXE").RemoveExtension("exe").c_str()); + EXPECT_EQ("app", FilePath("app.cc").RemoveExtension("cc").string()); + EXPECT_EQ("app", FilePath("app.exe").RemoveExtension("exe").string()); + EXPECT_EQ("APP", FilePath("APP.EXE").RemoveExtension("exe").string()); } TEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) { - EXPECT_STREQ("app", FilePath("app").RemoveExtension("exe").c_str()); + EXPECT_EQ("app", FilePath("app").RemoveExtension("exe").string()); } TEST(FilePathTest, IsDirectory) { diff --git a/test/gtest-listener_test.cc b/test/gtest-listener_test.cc index 1008608..99662cf 100644 --- a/test/gtest-listener_test.cc +++ b/test/gtest-listener_test.cc @@ -45,10 +45,9 @@ using ::testing::TestEventListener; using ::testing::TestInfo; using ::testing::TestPartResult; using ::testing::UnitTest; -using ::testing::internal::String; // Used by tests to register their events. -std::vector* g_events = NULL; +std::vector* g_events = NULL; namespace testing { namespace internal { @@ -119,54 +118,52 @@ class EventRecordingListener : public TestEventListener { } private: - String GetFullMethodName(const char* name) { - Message message; - message << name_ << "." << name; - return message.GetString(); + std::string GetFullMethodName(const char* name) { + return name_ + "." + name; } - String name_; + std::string name_; }; class EnvironmentInvocationCatcher : public Environment { protected: virtual void SetUp() { - g_events->push_back(String("Environment::SetUp")); + g_events->push_back("Environment::SetUp"); } virtual void TearDown() { - g_events->push_back(String("Environment::TearDown")); + g_events->push_back("Environment::TearDown"); } }; class ListenerTest : public Test { protected: static void SetUpTestCase() { - g_events->push_back(String("ListenerTest::SetUpTestCase")); + g_events->push_back("ListenerTest::SetUpTestCase"); } static void TearDownTestCase() { - g_events->push_back(String("ListenerTest::TearDownTestCase")); + g_events->push_back("ListenerTest::TearDownTestCase"); } virtual void SetUp() { - g_events->push_back(String("ListenerTest::SetUp")); + g_events->push_back("ListenerTest::SetUp"); } virtual void TearDown() { - g_events->push_back(String("ListenerTest::TearDown")); + g_events->push_back("ListenerTest::TearDown"); } }; TEST_F(ListenerTest, DoesFoo) { // Test execution order within a test case is not guaranteed so we are not // recording the test name. - g_events->push_back(String("ListenerTest::* Test Body")); + g_events->push_back("ListenerTest::* Test Body"); SUCCEED(); // Triggers OnTestPartResult. } TEST_F(ListenerTest, DoesBar) { - g_events->push_back(String("ListenerTest::* Test Body")); + g_events->push_back("ListenerTest::* Test Body"); SUCCEED(); // Triggers OnTestPartResult. } @@ -177,7 +174,7 @@ TEST_F(ListenerTest, DoesBar) { using ::testing::internal::EnvironmentInvocationCatcher; using ::testing::internal::EventRecordingListener; -void VerifyResults(const std::vector& data, +void VerifyResults(const std::vector& data, const char* const* expected_data, int expected_data_size) { const int actual_size = data.size(); @@ -201,7 +198,7 @@ void VerifyResults(const std::vector& data, } int main(int argc, char **argv) { - std::vector events; + std::vector events; g_events = &events; InitGoogleTest(&argc, argv); diff --git a/test/gtest-message_test.cc b/test/gtest-message_test.cc index c09c6a8..175238e 100644 --- a/test/gtest-message_test.cc +++ b/test/gtest-message_test.cc @@ -39,79 +39,72 @@ namespace { using ::testing::Message; -// A helper function that turns a Message into a C string. -const char* ToCString(const Message& msg) { - static testing::internal::String result; - result = msg.GetString(); - return result.c_str(); -} - // Tests the testing::Message class // Tests the default constructor. TEST(MessageTest, DefaultConstructor) { const Message msg; - EXPECT_STREQ("", ToCString(msg)); + EXPECT_EQ("", msg.GetString()); } // Tests the copy constructor. TEST(MessageTest, CopyConstructor) { const Message msg1("Hello"); const Message msg2(msg1); - EXPECT_STREQ("Hello", ToCString(msg2)); + EXPECT_EQ("Hello", msg2.GetString()); } // Tests constructing a Message from a C-string. TEST(MessageTest, ConstructsFromCString) { Message msg("Hello"); - EXPECT_STREQ("Hello", ToCString(msg)); + EXPECT_EQ("Hello", msg.GetString()); } // Tests streaming a float. TEST(MessageTest, StreamsFloat) { - const char* const s = ToCString(Message() << 1.23456F << " " << 2.34567F); + const std::string s = (Message() << 1.23456F << " " << 2.34567F).GetString(); // Both numbers should be printed with enough precision. - EXPECT_PRED_FORMAT2(testing::IsSubstring, "1.234560", s); - EXPECT_PRED_FORMAT2(testing::IsSubstring, " 2.345669", s); + EXPECT_PRED_FORMAT2(testing::IsSubstring, "1.234560", s.c_str()); + EXPECT_PRED_FORMAT2(testing::IsSubstring, " 2.345669", s.c_str()); } // Tests streaming a double. TEST(MessageTest, StreamsDouble) { - const char* const s = ToCString(Message() << 1260570880.4555497 << " " - << 1260572265.1954534); + const std::string s = (Message() << 1260570880.4555497 << " " + << 1260572265.1954534).GetString(); // Both numbers should be printed with enough precision. - EXPECT_PRED_FORMAT2(testing::IsSubstring, "1260570880.45", s); - EXPECT_PRED_FORMAT2(testing::IsSubstring, " 1260572265.19", s); + EXPECT_PRED_FORMAT2(testing::IsSubstring, "1260570880.45", s.c_str()); + EXPECT_PRED_FORMAT2(testing::IsSubstring, " 1260572265.19", s.c_str()); } // Tests streaming a non-char pointer. TEST(MessageTest, StreamsPointer) { int n = 0; int* p = &n; - EXPECT_STRNE("(null)", ToCString(Message() << p)); + EXPECT_NE("(null)", (Message() << p).GetString()); } // Tests streaming a NULL non-char pointer. TEST(MessageTest, StreamsNullPointer) { int* p = NULL; - EXPECT_STREQ("(null)", ToCString(Message() << p)); + EXPECT_EQ("(null)", (Message() << p).GetString()); } // Tests streaming a C string. TEST(MessageTest, StreamsCString) { - EXPECT_STREQ("Foo", ToCString(Message() << "Foo")); + EXPECT_EQ("Foo", (Message() << "Foo").GetString()); } // Tests streaming a NULL C string. TEST(MessageTest, StreamsNullCString) { char* p = NULL; - EXPECT_STREQ("(null)", ToCString(Message() << p)); + EXPECT_EQ("(null)", (Message() << p).GetString()); } // Tests streaming std::string. TEST(MessageTest, StreamsString) { const ::std::string str("Hello"); - EXPECT_STREQ("Hello", ToCString(Message() << str)); + EXPECT_EQ("Hello", (Message() << str).GetString()); } // Tests that we can output strings containing embedded NULs. @@ -120,34 +113,34 @@ TEST(MessageTest, StreamsStringWithEmbeddedNUL) { "Here's a NUL\0 and some more string"; const ::std::string string_with_nul(char_array_with_nul, sizeof(char_array_with_nul) - 1); - EXPECT_STREQ("Here's a NUL\\0 and some more string", - ToCString(Message() << string_with_nul)); + EXPECT_EQ("Here's a NUL\\0 and some more string", + (Message() << string_with_nul).GetString()); } // Tests streaming a NUL char. TEST(MessageTest, StreamsNULChar) { - EXPECT_STREQ("\\0", ToCString(Message() << '\0')); + EXPECT_EQ("\\0", (Message() << '\0').GetString()); } // Tests streaming int. TEST(MessageTest, StreamsInt) { - EXPECT_STREQ("123", ToCString(Message() << 123)); + EXPECT_EQ("123", (Message() << 123).GetString()); } // Tests that basic IO manipulators (endl, ends, and flush) can be // streamed to Message. TEST(MessageTest, StreamsBasicIoManip) { - EXPECT_STREQ("Line 1.\nA NUL char \\0 in line 2.", - ToCString(Message() << "Line 1." << std::endl + EXPECT_EQ("Line 1.\nA NUL char \\0 in line 2.", + (Message() << "Line 1." << std::endl << "A NUL char " << std::ends << std::flush - << " in line 2.")); + << " in line 2.").GetString()); } // Tests Message::GetString() TEST(MessageTest, GetString) { Message msg; msg << 1 << " lamb"; - EXPECT_STREQ("1 lamb", msg.GetString().c_str()); + EXPECT_EQ("1 lamb", msg.GetString()); } // Tests streaming a Message object to an ostream. @@ -155,7 +148,7 @@ TEST(MessageTest, StreamsToOStream) { Message msg("Hello"); ::std::stringstream ss; ss << msg; - EXPECT_STREQ("Hello", testing::internal::StringStreamToString(&ss).c_str()); + EXPECT_EQ("Hello", testing::internal::StringStreamToString(&ss)); } // Tests that a Message object doesn't take up too much stack space. diff --git a/test/gtest-options_test.cc b/test/gtest-options_test.cc index 9e98f3f..5586dc3 100644 --- a/test/gtest-options_test.cc +++ b/test/gtest-options_test.cc @@ -78,14 +78,14 @@ TEST(XmlOutputTest, GetOutputFormat) { TEST(XmlOutputTest, GetOutputFileDefault) { GTEST_FLAG(output) = ""; - EXPECT_STREQ(GetAbsolutePathOf(FilePath("test_detail.xml")).c_str(), - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); + EXPECT_EQ(GetAbsolutePathOf(FilePath("test_detail.xml")).string(), + UnitTestOptions::GetAbsolutePathToOutputFile()); } TEST(XmlOutputTest, GetOutputFileSingleFile) { GTEST_FLAG(output) = "xml:filename.abc"; - EXPECT_STREQ(GetAbsolutePathOf(FilePath("filename.abc")).c_str(), - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); + EXPECT_EQ(GetAbsolutePathOf(FilePath("filename.abc")).string(), + UnitTestOptions::GetAbsolutePathToOutputFile()); } TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) { @@ -93,8 +93,9 @@ TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) { const std::string expected_output_file = GetAbsolutePathOf( FilePath(std::string("path") + GTEST_PATH_SEP_ + - GetCurrentExecutableName().c_str() + ".xml")).c_str(); - const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile(); + GetCurrentExecutableName().string() + ".xml")).string(); + const std::string& output_file = + UnitTestOptions::GetAbsolutePathToOutputFile(); #if GTEST_OS_WINDOWS EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str()); #else @@ -103,7 +104,7 @@ TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) { } TEST(OutputFileHelpersTest, GetCurrentExecutableName) { - const std::string exe_str = GetCurrentExecutableName().c_str(); + const std::string exe_str = GetCurrentExecutableName().string(); #if GTEST_OS_WINDOWS const bool success = _strcmpi("gtest-options_test", exe_str.c_str()) == 0 || @@ -129,12 +130,12 @@ class XmlOutputChangeDirTest : public Test { original_working_dir_ = FilePath::GetCurrentDir(); posix::ChDir(".."); // This will make the test fail if run from the root directory. - EXPECT_STRNE(original_working_dir_.c_str(), - FilePath::GetCurrentDir().c_str()); + EXPECT_NE(original_working_dir_.string(), + FilePath::GetCurrentDir().string()); } virtual void TearDown() { - posix::ChDir(original_working_dir_.c_str()); + posix::ChDir(original_working_dir_.string().c_str()); } FilePath original_working_dir_; @@ -142,23 +143,23 @@ class XmlOutputChangeDirTest : public Test { TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefault) { GTEST_FLAG(output) = ""; - EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_, - FilePath("test_detail.xml")).c_str(), - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); + EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_, + FilePath("test_detail.xml")).string(), + UnitTestOptions::GetAbsolutePathToOutputFile()); } TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithDefaultXML) { GTEST_FLAG(output) = "xml"; - EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_, - FilePath("test_detail.xml")).c_str(), - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); + EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_, + FilePath("test_detail.xml")).string(), + UnitTestOptions::GetAbsolutePathToOutputFile()); } TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) { GTEST_FLAG(output) = "xml:filename.abc"; - EXPECT_STREQ(FilePath::ConcatPaths(original_working_dir_, - FilePath("filename.abc")).c_str(), - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); + EXPECT_EQ(FilePath::ConcatPaths(original_working_dir_, + FilePath("filename.abc")).string(), + UnitTestOptions::GetAbsolutePathToOutputFile()); } TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) { @@ -167,8 +168,9 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) { FilePath::ConcatPaths( original_working_dir_, FilePath(std::string("path") + GTEST_PATH_SEP_ + - GetCurrentExecutableName().c_str() + ".xml")).c_str(); - const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile(); + GetCurrentExecutableName().string() + ".xml")).string(); + const std::string& output_file = + UnitTestOptions::GetAbsolutePathToOutputFile(); #if GTEST_OS_WINDOWS EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str()); #else @@ -179,12 +181,12 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) { TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) { #if GTEST_OS_WINDOWS GTEST_FLAG(output) = "xml:c:\\tmp\\filename.abc"; - EXPECT_STREQ(FilePath("c:\\tmp\\filename.abc").c_str(), - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); + EXPECT_EQ(FilePath("c:\\tmp\\filename.abc").string(), + UnitTestOptions::GetAbsolutePathToOutputFile()); #else GTEST_FLAG(output) ="xml:/tmp/filename.abc"; - EXPECT_STREQ(FilePath("/tmp/filename.abc").c_str(), - UnitTestOptions::GetAbsolutePathToOutputFile().c_str()); + EXPECT_EQ(FilePath("/tmp/filename.abc").string(), + UnitTestOptions::GetAbsolutePathToOutputFile()); #endif } @@ -197,8 +199,9 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) { GTEST_FLAG(output) = "xml:" + path; const std::string expected_output_file = - path + GetCurrentExecutableName().c_str() + ".xml"; - const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile(); + path + GetCurrentExecutableName().string() + ".xml"; + const std::string& output_file = + UnitTestOptions::GetAbsolutePathToOutputFile(); #if GTEST_OS_WINDOWS EXPECT_STRCASEEQ(expected_output_file.c_str(), output_file.c_str()); diff --git a/test/gtest-param-test_test.cc b/test/gtest-param-test_test.cc index cf61866..7b6f7e2 100644 --- a/test/gtest-param-test_test.cc +++ b/test/gtest-param-test_test.cc @@ -280,10 +280,10 @@ class DogAdder { bool operator<(const DogAdder& other) const { return value_ < other.value_; } - const ::testing::internal::String& value() const { return value_; } + const std::string& value() const { return value_; } private: - ::testing::internal::String value_; + std::string value_; }; TEST(RangeTest, WorksWithACustomType) { 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 thread_local_string; + ThreadLocal thread_local_string; EXPECT_EQ(thread_local_string.pointer(), &(thread_local_string.get())); @@ -1015,8 +1015,9 @@ TEST(ThreadLocalTest, GetAndPointerReturnSameValue) { } TEST(ThreadLocalTest, PointerAndConstPointerReturnSameValue) { - ThreadLocal thread_local_string; - const ThreadLocal& const_thread_local_string = thread_local_string; + ThreadLocal thread_local_string; + const ThreadLocal& 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*, String*> param) { +void RetrieveThreadLocalValue( + pair*, std::string*> param) { *param.second = param.first->get(); } TEST(ThreadLocalTest, ParameterizedConstructorSetsDefault) { - ThreadLocal thread_local_string("foo"); + ThreadLocal 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 thread_local_string; + ThreadLocal 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 diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc index da8b744..07ab633 100644 --- a/test/gtest_output_test_.cc +++ b/test/gtest_output_test_.cc @@ -58,7 +58,6 @@ using testing::internal::ThreadWithParam; #endif namespace posix = ::testing::internal::posix; -using testing::internal::String; using testing::internal::scoped_ptr; // Tests catching fatal failures. @@ -1005,7 +1004,8 @@ int main(int argc, char **argv) { // for it. testing::InitGoogleTest(&argc, argv); if (argc >= 2 && - String(argv[1]) == "--gtest_internal_skip_environment_and_ad_hoc_tests") + (std::string(argv[1]) == + "--gtest_internal_skip_environment_and_ad_hoc_tests")) GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = true; #if GTEST_HAS_DEATH_TEST diff --git a/test/gtest_shuffle_test_.cc b/test/gtest_shuffle_test_.cc index 0752789..6fb441b 100644 --- a/test/gtest_shuffle_test_.cc +++ b/test/gtest_shuffle_test_.cc @@ -42,7 +42,6 @@ using ::testing::Test; using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::UnitTest; -using ::testing::internal::String; using ::testing::internal::scoped_ptr; // The test methods are empty, as the sole purpose of this program is diff --git a/test/gtest_stress_test.cc b/test/gtest_stress_test.cc index 4e7d9bf..e7daa43 100644 --- a/test/gtest_stress_test.cc +++ b/test/gtest_stress_test.cc @@ -50,7 +50,6 @@ namespace testing { namespace { using internal::Notification; -using internal::String; using internal::TestPropertyKeyIs; using internal::ThreadWithParam; using internal::scoped_ptr; @@ -62,13 +61,13 @@ using internal::scoped_ptr; // How many threads to create? const int kThreadCount = 50; -String IdToKey(int id, const char* suffix) { +std::string IdToKey(int id, const char* suffix) { Message key; key << "key_" << id << "_" << suffix; return key.GetString(); } -String IdToString(int id) { +std::string IdToString(int id) { Message id_message; id_message << id; return id_message.GetString(); diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index 79e11b6..f4f3043 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -931,259 +931,16 @@ TEST(AssertHelperTest, AssertHelperIsSmall) { EXPECT_LE(sizeof(testing::internal::AssertHelper), sizeof(void*)); } -// Tests the String class. - -// Tests String's constructors. -TEST(StringTest, Constructors) { - // Default ctor. - String s1; - // We aren't using EXPECT_EQ(NULL, s1.c_str()) because comparing - // pointers with NULL isn't supported on all platforms. - EXPECT_EQ(0U, s1.length()); - EXPECT_TRUE(NULL == s1.c_str()); - - // Implicitly constructs from a C-string. - String s2 = "Hi"; - EXPECT_EQ(2U, s2.length()); - EXPECT_STREQ("Hi", s2.c_str()); - - // Constructs from a C-string and a length. - String s3("hello", 3); - EXPECT_EQ(3U, s3.length()); - EXPECT_STREQ("hel", s3.c_str()); - - // The empty String should be created when String is constructed with - // a NULL pointer and length 0. - EXPECT_EQ(0U, String(NULL, 0).length()); - EXPECT_FALSE(String(NULL, 0).c_str() == NULL); - - // Constructs a String that contains '\0'. - String s4("a\0bcd", 4); - EXPECT_EQ(4U, s4.length()); - EXPECT_EQ('a', s4.c_str()[0]); - EXPECT_EQ('\0', s4.c_str()[1]); - EXPECT_EQ('b', s4.c_str()[2]); - EXPECT_EQ('c', s4.c_str()[3]); - - // Copy ctor where the source is NULL. - const String null_str; - String s5 = null_str; - EXPECT_TRUE(s5.c_str() == NULL); - - // Copy ctor where the source isn't NULL. - String s6 = s3; - EXPECT_EQ(3U, s6.length()); - EXPECT_STREQ("hel", s6.c_str()); - - // Copy ctor where the source contains '\0'. - String s7 = s4; - EXPECT_EQ(4U, s7.length()); - EXPECT_EQ('a', s7.c_str()[0]); - EXPECT_EQ('\0', s7.c_str()[1]); - EXPECT_EQ('b', s7.c_str()[2]); - EXPECT_EQ('c', s7.c_str()[3]); -} - -TEST(StringTest, ConvertsFromStdString) { - // An empty std::string. - const std::string src1(""); - const String dest1 = src1; - EXPECT_EQ(0U, dest1.length()); - EXPECT_STREQ("", dest1.c_str()); - - // A normal std::string. - const std::string src2("Hi"); - const String dest2 = src2; - EXPECT_EQ(2U, dest2.length()); - EXPECT_STREQ("Hi", dest2.c_str()); - - // An std::string with an embedded NUL character. - const char src3[] = "a\0b"; - const String dest3 = std::string(src3, sizeof(src3)); - EXPECT_EQ(sizeof(src3), dest3.length()); - EXPECT_EQ('a', dest3.c_str()[0]); - EXPECT_EQ('\0', dest3.c_str()[1]); - EXPECT_EQ('b', dest3.c_str()[2]); -} - -TEST(StringTest, ConvertsToStdString) { - // An empty String. - const String src1(""); - const std::string dest1 = src1; - EXPECT_EQ("", dest1); - - // A normal String. - const String src2("Hi"); - const std::string dest2 = src2; - EXPECT_EQ("Hi", dest2); - - // A String containing a '\0'. - const String src3("x\0y", 3); - const std::string dest3 = src3; - EXPECT_EQ(std::string("x\0y", 3), dest3); -} - -#if GTEST_HAS_GLOBAL_STRING - -TEST(StringTest, ConvertsFromGlobalString) { - // An empty ::string. - const ::string src1(""); - const String dest1 = src1; - EXPECT_EQ(0U, dest1.length()); - EXPECT_STREQ("", dest1.c_str()); - - // A normal ::string. - const ::string src2("Hi"); - const String dest2 = src2; - EXPECT_EQ(2U, dest2.length()); - EXPECT_STREQ("Hi", dest2.c_str()); - - // An ::string with an embedded NUL character. - const char src3[] = "x\0y"; - const String dest3 = ::string(src3, sizeof(src3)); - EXPECT_EQ(sizeof(src3), dest3.length()); - EXPECT_EQ('x', dest3.c_str()[0]); - EXPECT_EQ('\0', dest3.c_str()[1]); - EXPECT_EQ('y', dest3.c_str()[2]); -} - -TEST(StringTest, ConvertsToGlobalString) { - // An empty String. - const String src1(""); - const ::string dest1 = src1; - EXPECT_EQ("", dest1); - - // A normal String. - const String src2("Hi"); - const ::string dest2 = src2; - EXPECT_EQ("Hi", dest2); - - const String src3("x\0y", 3); - const ::string dest3 = src3; - EXPECT_EQ(::string("x\0y", 3), dest3); -} - -#endif // GTEST_HAS_GLOBAL_STRING - -// Tests String::empty(). -TEST(StringTest, Empty) { - EXPECT_TRUE(String("").empty()); - EXPECT_FALSE(String().empty()); - EXPECT_FALSE(String(NULL).empty()); - EXPECT_FALSE(String("a").empty()); - EXPECT_FALSE(String("\0", 1).empty()); -} - -// Tests String::Compare(). -TEST(StringTest, Compare) { - // NULL vs NULL. - EXPECT_EQ(0, String().Compare(String())); - - // NULL vs non-NULL. - EXPECT_EQ(-1, String().Compare(String(""))); - - // Non-NULL vs NULL. - EXPECT_EQ(1, String("").Compare(String())); - - // The following covers non-NULL vs non-NULL. - - // "" vs "". - EXPECT_EQ(0, String("").Compare(String(""))); - - // "" vs non-"". - EXPECT_EQ(-1, String("").Compare(String("\0", 1))); - EXPECT_EQ(-1, String("").Compare(" ")); - - // Non-"" vs "". - EXPECT_EQ(1, String("a").Compare(String(""))); - - // The following covers non-"" vs non-"". - - // Same length and equal. - EXPECT_EQ(0, String("a").Compare(String("a"))); - - // Same length and different. - EXPECT_EQ(-1, String("a\0b", 3).Compare(String("a\0c", 3))); - EXPECT_EQ(1, String("b").Compare(String("a"))); - - // Different lengths. - EXPECT_EQ(-1, String("a").Compare(String("ab"))); - EXPECT_EQ(-1, String("a").Compare(String("a\0", 2))); - EXPECT_EQ(1, String("abc").Compare(String("aacd"))); -} - -// Tests String::operator==(). -TEST(StringTest, Equals) { - const String null(NULL); - EXPECT_TRUE(null == NULL); // NOLINT - EXPECT_FALSE(null == ""); // NOLINT - EXPECT_FALSE(null == "bar"); // NOLINT - - const String empty(""); - EXPECT_FALSE(empty == NULL); // NOLINT - EXPECT_TRUE(empty == ""); // NOLINT - EXPECT_FALSE(empty == "bar"); // NOLINT - - const String foo("foo"); - EXPECT_FALSE(foo == NULL); // NOLINT - EXPECT_FALSE(foo == ""); // NOLINT - EXPECT_FALSE(foo == "bar"); // NOLINT - EXPECT_TRUE(foo == "foo"); // NOLINT - - const String bar("x\0y", 3); - EXPECT_NE(bar, "x"); -} - -// Tests String::operator!=(). -TEST(StringTest, NotEquals) { - const String null(NULL); - EXPECT_FALSE(null != NULL); // NOLINT - EXPECT_TRUE(null != ""); // NOLINT - EXPECT_TRUE(null != "bar"); // NOLINT - - const String empty(""); - EXPECT_TRUE(empty != NULL); // NOLINT - EXPECT_FALSE(empty != ""); // NOLINT - EXPECT_TRUE(empty != "bar"); // NOLINT - - const String foo("foo"); - EXPECT_TRUE(foo != NULL); // NOLINT - EXPECT_TRUE(foo != ""); // NOLINT - EXPECT_TRUE(foo != "bar"); // NOLINT - EXPECT_FALSE(foo != "foo"); // NOLINT - - const String bar("x\0y", 3); - EXPECT_NE(bar, "x"); -} - -// Tests String::length(). -TEST(StringTest, Length) { - EXPECT_EQ(0U, String().length()); - EXPECT_EQ(0U, String("").length()); - EXPECT_EQ(2U, String("ab").length()); - EXPECT_EQ(3U, String("a\0b", 3).length()); -} - -// Tests String::EndsWith(). -TEST(StringTest, EndsWith) { - EXPECT_TRUE(String("foobar").EndsWith("bar")); - EXPECT_TRUE(String("foobar").EndsWith("")); - EXPECT_TRUE(String("").EndsWith("")); - - EXPECT_FALSE(String("foobar").EndsWith("foo")); - EXPECT_FALSE(String("").EndsWith("foo")); -} - // Tests String::EndsWithCaseInsensitive(). TEST(StringTest, EndsWithCaseInsensitive) { - EXPECT_TRUE(String("foobar").EndsWithCaseInsensitive("BAR")); - EXPECT_TRUE(String("foobaR").EndsWithCaseInsensitive("bar")); - EXPECT_TRUE(String("foobar").EndsWithCaseInsensitive("")); - EXPECT_TRUE(String("").EndsWithCaseInsensitive("")); + EXPECT_TRUE(String::EndsWithCaseInsensitive("foobar", "BAR")); + EXPECT_TRUE(String::EndsWithCaseInsensitive("foobaR", "bar")); + EXPECT_TRUE(String::EndsWithCaseInsensitive("foobar", "")); + EXPECT_TRUE(String::EndsWithCaseInsensitive("", "")); - EXPECT_FALSE(String("Foobar").EndsWithCaseInsensitive("foo")); - EXPECT_FALSE(String("foobar").EndsWithCaseInsensitive("Foo")); - EXPECT_FALSE(String("").EndsWithCaseInsensitive("foo")); + EXPECT_FALSE(String::EndsWithCaseInsensitive("Foobar", "foo")); + EXPECT_FALSE(String::EndsWithCaseInsensitive("foobar", "Foo")); + EXPECT_FALSE(String::EndsWithCaseInsensitive("", "foo")); } // C++Builder's preprocessor is buggy; it fails to expand macros that @@ -1203,61 +960,6 @@ TEST(StringTest, CaseInsensitiveWideCStringEquals) { EXPECT_TRUE(String::CaseInsensitiveWideCStringEquals(L"FOOBAR", L"foobar")); } -// Tests that NULL can be assigned to a String. -TEST(StringTest, CanBeAssignedNULL) { - const String src(NULL); - String dest; - - dest = src; - EXPECT_STREQ(NULL, dest.c_str()); -} - -// Tests that the empty string "" can be assigned to a String. -TEST(StringTest, CanBeAssignedEmpty) { - const String src(""); - String dest; - - dest = src; - EXPECT_STREQ("", dest.c_str()); -} - -// Tests that a non-empty string can be assigned to a String. -TEST(StringTest, CanBeAssignedNonEmpty) { - const String src("hello"); - String dest; - dest = src; - EXPECT_EQ(5U, dest.length()); - EXPECT_STREQ("hello", dest.c_str()); - - const String src2("x\0y", 3); - String dest2; - dest2 = src2; - EXPECT_EQ(3U, dest2.length()); - EXPECT_EQ('x', dest2.c_str()[0]); - EXPECT_EQ('\0', dest2.c_str()[1]); - EXPECT_EQ('y', dest2.c_str()[2]); -} - -// Tests that a String can be assigned to itself. -TEST(StringTest, CanBeAssignedSelf) { - String dest("hello"); - - // Use explicit function call notation here to suppress self-assign warning. - dest.operator=(dest); - EXPECT_STREQ("hello", dest.c_str()); -} - -// Sun Studio < 12 incorrectly rejects this code due to an overloading -// ambiguity. -#if !(defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) -// Tests streaming a String. -TEST(StringTest, Streams) { - EXPECT_EQ(StreamableToString(String()), "(null)"); - EXPECT_EQ(StreamableToString(String("")), ""); - EXPECT_EQ(StreamableToString(String("a\0b", 3)), "a\\0b"); -} -#endif - // Tests that String::Format() works. TEST(StringTest, FormatWorks) { // Normal case: the format spec is valid, the arguments match the @@ -1269,19 +971,19 @@ TEST(StringTest, FormatWorks) { const size_t kSize = sizeof(buffer); memset(buffer, 'a', kSize - 1); buffer[kSize - 1] = '\0'; - EXPECT_STREQ(buffer, String::Format("%s", buffer).c_str()); + EXPECT_EQ(buffer, String::Format("%s", buffer)); // The result needs to be 4096 characters, exceeding Format()'s limit. - EXPECT_STREQ("", - String::Format("x%s", buffer).c_str()); + EXPECT_EQ("", + String::Format("x%s", buffer)); #if GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID // On Linux, invalid format spec should lead to an error message. // In other environment (e.g. MSVC on Windows), String::Format() may // simply ignore a bad format spec, so this assertion is run on // Linux only. - EXPECT_STREQ("", - String::Format("%").c_str()); + EXPECT_EQ("", + String::Format("%")); #endif } @@ -1915,15 +1617,16 @@ static void SetEnv(const char* name, const char* value) { // C++Builder's putenv only stores a pointer to its parameter; we have to // ensure that the string remains valid as long as it might be needed. // We use an std::map to do so. - static std::map added_env; + static std::map added_env; // Because putenv stores a pointer to the string buffer, we can't delete the // previous string (if present) until after it's replaced. - String *prev_env = NULL; + std::string *prev_env = NULL; if (added_env.find(name) != added_env.end()) { prev_env = added_env[name]; } - added_env[name] = new String((Message() << name << "=" << value).GetString()); + added_env[name] = new std::string( + (Message() << name << "=" << value).GetString()); // The standard signature of putenv accepts a 'char*' argument. Other // implementations, like C++Builder's, accept a 'const char*'. @@ -3568,8 +3271,8 @@ TEST_F(NoFatalFailureTest, MessageIsStreamable) { // Tests EqFailure(), used for implementing *EQ* assertions. TEST(AssertionTest, EqFailure) { - const String foo_val("5"), bar_val("6"); - const String msg1( + const std::string foo_val("5"), bar_val("6"); + const std::string msg1( EqFailure("foo", "bar", foo_val, bar_val, false) .failure_message()); EXPECT_STREQ( @@ -3579,7 +3282,7 @@ TEST(AssertionTest, EqFailure) { "Which is: 5", msg1.c_str()); - const String msg2( + const std::string msg2( EqFailure("foo", "6", foo_val, bar_val, false) .failure_message()); EXPECT_STREQ( @@ -3588,7 +3291,7 @@ TEST(AssertionTest, EqFailure) { "Which is: 5", msg2.c_str()); - const String msg3( + const std::string msg3( EqFailure("5", "bar", foo_val, bar_val, false) .failure_message()); EXPECT_STREQ( @@ -3597,16 +3300,16 @@ TEST(AssertionTest, EqFailure) { "Expected: 5", msg3.c_str()); - const String msg4( + const std::string msg4( EqFailure("5", "6", foo_val, bar_val, false).failure_message()); EXPECT_STREQ( "Value of: 6\n" "Expected: 5", msg4.c_str()); - const String msg5( + const std::string msg5( EqFailure("foo", "bar", - String("\"x\""), String("\"y\""), + std::string("\"x\""), std::string("\"y\""), true).failure_message()); EXPECT_STREQ( "Value of: bar\n" @@ -3618,7 +3321,7 @@ TEST(AssertionTest, EqFailure) { // Tests AppendUserMessage(), used for implementing the *EQ* macros. TEST(AssertionTest, AppendUserMessage) { - const String foo("foo"); + const std::string foo("foo"); Message msg; EXPECT_STREQ("foo", @@ -4199,7 +3902,7 @@ TEST(AssertionSyntaxTest, WorksWithSwitch) { #if GTEST_HAS_EXCEPTIONS void ThrowAString() { - throw "String"; + throw "std::string"; } // Test that the exception assertion macros compile and work with const @@ -5619,7 +5322,7 @@ class InitGoogleTestTest : public Test { internal::ParseGoogleTestFlagsOnly(&argc1, const_cast(argv1)); #if GTEST_HAS_STREAM_REDIRECTION - const String captured_stdout = GetCapturedStdout(); + const std::string captured_stdout = GetCapturedStdout(); #endif // Verifies the flag values. @@ -6891,7 +6594,7 @@ TEST(TestEventListenersTest, Append) { // order. class SequenceTestingListener : public EmptyTestEventListener { public: - SequenceTestingListener(std::vector* vector, const char* id) + SequenceTestingListener(std::vector* vector, const char* id) : vector_(vector), id_(id) {} protected: @@ -6914,20 +6617,20 @@ class SequenceTestingListener : public EmptyTestEventListener { } private: - String GetEventDescription(const char* method) { + std::string GetEventDescription(const char* method) { Message message; message << id_ << "." << method; return message.GetString(); } - std::vector* vector_; + std::vector* vector_; const char* const id_; GTEST_DISALLOW_COPY_AND_ASSIGN_(SequenceTestingListener); }; TEST(EventListenerTest, AppendKeepsOrder) { - std::vector vec; + std::vector vec; TestEventListeners listeners; listeners.Append(new SequenceTestingListener(&vec, "1st")); listeners.Append(new SequenceTestingListener(&vec, "2nd")); @@ -7313,7 +7016,7 @@ TEST(GTestReferenceToConstTest, Works) { TestGTestReferenceToConst(); TestGTestReferenceToConst(); TestGTestReferenceToConst(); - TestGTestReferenceToConst(); + TestGTestReferenceToConst(); } // Tests that ImplicitlyConvertible::value is a compile-time constant. -- cgit v1.2.1