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 | dbe77cfa0bcae10d91fbdbf118a97ec212afc88e (patch) | |
tree | 9f6c4d9df8765d8bb66a7f98693bc66f8945b9a5 /unittests/ADT/StringRefTest.cpp | |
parent | 59fec6a53234df91d6b66d5826ef1f8ce60af2fa (diff) |
Support writing a StringRef to a raw_ostream directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76754 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ADT/StringRefTest.cpp')
-rw-r--r-- | unittests/ADT/StringRefTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp index bb46dc010a..ba2216debd 100644 --- a/unittests/ADT/StringRefTest.cpp +++ b/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 |