aboutsummaryrefslogtreecommitdiffstats
path: root/unittests/ADT/TwineTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/ADT/TwineTest.cpp')
-rw-r--r--unittests/ADT/TwineTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/ADT/TwineTest.cpp b/unittests/ADT/TwineTest.cpp
index 61e8a0a..57f54cb 100644
--- a/unittests/ADT/TwineTest.cpp
+++ b/unittests/ADT/TwineTest.cpp
@@ -9,6 +9,7 @@
#include "gtest/gtest.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -69,6 +70,13 @@ TEST(TwineTest, Concat) {
repr(Twine("a").concat(Twine("b").concat(Twine("c")))));
}
+TEST(TwineTest, toNullTerminatedStringRef) {
+ SmallString<8> storage;
+ EXPECT_EQ(0, *Twine("hello").toNullTerminatedStringRef(storage).end());
+ EXPECT_EQ(0,
+ *Twine(StringRef("hello")).toNullTerminatedStringRef(storage).end());
+}
+
// I suppose linking in the entire code generator to add a unit test to check
// the code size of the concat operation is overkill... :)