summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/unittests/ADT/StringRefTest.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-14 19:55:43 +0000
committerpatrick <patrick@openbsd.org>2017-01-14 19:55:43 +0000
commitbd3306aecb3a15e8967143b8cdbbccf2b1b19b74 (patch)
tree309a8132b44564b9e634c0da6815187ce8eab27c /gnu/llvm/unittests/ADT/StringRefTest.cpp
parentkillp -a should not kill the window if only one pane. (diff)
downloadwireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.tar.xz
wireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.zip
Import LLVM 3.9.1 including clang and lld.
Diffstat (limited to 'gnu/llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r--gnu/llvm/unittests/ADT/StringRefTest.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/gnu/llvm/unittests/ADT/StringRefTest.cpp b/gnu/llvm/unittests/ADT/StringRefTest.cpp
index 6cf2e6a0454..66e5944b56e 100644
--- a/gnu/llvm/unittests/ADT/StringRefTest.cpp
+++ b/gnu/llvm/unittests/ADT/StringRefTest.cpp
@@ -301,7 +301,7 @@ TEST(StringRefTest, Trim) {
EXPECT_EQ(StringRef(""), StringRef(" ").trim());
EXPECT_EQ(StringRef("\0", 1), StringRef(" \0 ", 3).trim());
EXPECT_EQ(StringRef("\0\0", 2), StringRef("\0\0", 2).trim());
- EXPECT_EQ(StringRef("x"), StringRef("\0\0x\0\0", 5).trim(StringRef("\0", 1)));
+ EXPECT_EQ(StringRef("x"), StringRef("\0\0x\0\0", 5).trim('\0'));
}
TEST(StringRefTest, StartsWith) {
@@ -589,6 +589,15 @@ TEST(StringRefTest, joinStrings) {
TEST(StringRefTest, AllocatorCopy) {
BumpPtrAllocator Alloc;
+ // First test empty strings. We don't want these to allocate anything on the
+ // allocator.
+ StringRef StrEmpty = "";
+ StringRef StrEmptyc = StrEmpty.copy(Alloc);
+ EXPECT_TRUE(StrEmpty.equals(StrEmptyc));
+ EXPECT_EQ(StrEmptyc.data(), nullptr);
+ EXPECT_EQ(StrEmptyc.size(), 0u);
+ EXPECT_EQ(Alloc.getTotalMemory(), 0u);
+
StringRef Str1 = "hello";
StringRef Str2 = "bye";
StringRef Str1c = Str1.copy(Alloc);