From 3fb536bde6f584edf5202eb96ccdd69442882b95 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 22 Jul 2009 17:13:20 +0000 Subject: 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 --- unittests/ADT/StringRefTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'unittests') 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 -- cgit v1.1