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 | 3fb536bde6f584edf5202eb96ccdd69442882b95 (patch) | |
tree | 9f6c4d9df8765d8bb66a7f98693bc66f8945b9a5 /unittests | |
parent | 5af04d269912fe218d05351ad2838eea0e1f3854 (diff) | |
download | external_llvm-3fb536bde6f584edf5202eb96ccdd69442882b95.zip external_llvm-3fb536bde6f584edf5202eb96ccdd69442882b95.tar.gz external_llvm-3fb536bde6f584edf5202eb96ccdd69442882b95.tar.bz2 |
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')
-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 bb46dc0..ba2216d 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 |