mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user