diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
commit | cf099d11218cb6f6c5cce947d6738e347f07fb12 (patch) | |
tree | d2b61ce94e654cb01a254d2195259db5f9cc3f3c /unittests/ADT/TwineTest.cpp | |
parent | 49011b52fcba02a6051957b84705159f52fae4e4 (diff) |
Diffstat (limited to 'unittests/ADT/TwineTest.cpp')
-rw-r--r-- | unittests/ADT/TwineTest.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/ADT/TwineTest.cpp b/unittests/ADT/TwineTest.cpp index 61e8a0ac37cb..57f54cb0060f 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... :) |