diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-22 17:13:20 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-22 17:13:20 +0000 |
commit | e23388b25c40012dc5df73c1cda223afa95fa9db (patch) | |
tree | 332e84efaa616b079c604b9ea17d885eaa5f7d9b /llvm/unittests/ADT/StringRefTest.cpp | |
parent | 5173349565b36c60a8560f2449c2498741956188 (diff) | |
download | llvm-e23388b25c40012dc5df73c1cda223afa95fa9db.zip llvm-e23388b25c40012dc5df73c1cda223afa95fa9db.tar.gz llvm-e23388b25c40012dc5df73c1cda223afa95fa9db.tar.bz2 |
Support writing a StringRef to a raw_ostream directly.
llvm-svn: 76754
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 bb46dc0..ba2216d 100644 --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/unittests/ADT/StringRefTest.cpp @@ -9,6 +9,7 @@ #include "gtest/gtest.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; namespace { @@ -66,6 +67,11 @@ TEST(StringRefTest, Utilities) { EXPECT_TRUE(Str.startswith("he")); EXPECT_FALSE(Str.startswith("helloworld")); EXPECT_FALSE(Str.startswith("hi")); + + std::string Storage; + raw_string_ostream OS(Storage); + OS << StringRef("hello"); + EXPECT_EQ("hello", OS.str()); } } // end anonymous namespace |