diff options
author | dim <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-20 12:57:14 +0000 |
commit | cbb70ce070d220642b038ea101d9c0f9fbf860d6 (patch) | |
tree | d2b61ce94e654cb01a254d2195259db5f9cc3f3c /unittests/ADT/TwineTest.cpp | |
parent | 4ace901e87dac5bbbac78ed325e75462e48e386e (diff) | |
download | FreeBSD-src-cbb70ce070d220642b038ea101d9c0f9fbf860d6.zip FreeBSD-src-cbb70ce070d220642b038ea101d9c0f9fbf860d6.tar.gz |
Vendor import of llvm trunk r126079:
http://llvm.org/svn/llvm-project/llvm/trunk@126079
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 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... :) |