diff options
author | Sam McCall <sam.mccall@gmail.com> | 2019-08-21 13:56:29 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2019-08-21 13:56:29 +0000 |
commit | a451156bb6ceb3700f6ea42e47e9a95d67723318 (patch) | |
tree | 4227645ea627fffc6f82efaaec49e7573e954211 /llvm/unittests/ADT/StringRefTest.cpp | |
parent | 4d668a1f077d1ddea6130c52f793817063046b68 (diff) | |
download | llvm-a451156bb6ceb3700f6ea42e47e9a95d67723318.zip llvm-a451156bb6ceb3700f6ea42e47e9a95d67723318.tar.gz llvm-a451156bb6ceb3700f6ea42e47e9a95d67723318.tar.bz2 |
reland [gtest] Fix printing of StringRef and SmallString in assert messages.
Renames GTEST_NO_LLVM_RAW_OSTREAM -> GTEST_NO_LLVM_SUPPORT and guards
the new features behind it.
This reverts commit a063bcf3ef5a879adbe9639a3c187d876eee0e66.
llvm-svn: 369527
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringRefTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp index a45e83c..f341cf4 100644 --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/unittests/ADT/StringRefTest.cpp @@ -1055,6 +1055,12 @@ TEST(StringRefTest, StringLiteral) { EXPECT_EQ(StringRef("Bar"), Strings[1]); } +// Check gtest prints StringRef as a string instead of a container of chars. +// The code is in utils/unittest/googletest/internal/custom/gtest-printers.h +TEST(StringRefTest, GTestPrinter) { + EXPECT_EQ(R"("foo")", ::testing::PrintToString(StringRef("foo"))); +} + static_assert(is_trivially_copyable<StringRef>::value, "trivially copyable"); } // end anonymous namespace |