summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/TwineTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ADT/TwineTest.cpp')
-rw-r--r--llvm/unittests/ADT/TwineTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/TwineTest.cpp b/llvm/unittests/ADT/TwineTest.cpp
index 950eda2b058..ebe06917cee 100644
--- a/llvm/unittests/ADT/TwineTest.cpp
+++ b/llvm/unittests/ADT/TwineTest.cpp
@@ -88,6 +88,14 @@ TEST(TwineTest, Concat) {
repr(Twine("a").concat(Twine(SmallString<3>("b")).concat(Twine("c")))));
}
+TEST(TwineTest, Operators) {
+ EXPECT_EQ(R"((Twine cstring:"a" stringref:"b"))", repr("a" + StringRef("b")));
+
+ EXPECT_EQ(R"((Twine stringref:"a" cstring:"b"))", repr(StringRef("a") + "b"));
+ EXPECT_EQ(R"((Twine stringref:"a" stringref:"b"))",
+ repr(StringRef("a") + StringRef("b")));
+}
+
TEST(TwineTest, toNullTerminatedStringRef) {
SmallString<8> storage;
EXPECT_EQ(0, *Twine("hello").toNullTerminatedStringRef(storage).end());
OpenPOWER on IntegriCloud