Clean up SmallString a bit
Move a common utility (assign(iter, iter)) into SmallVector (some of the
others could be moved there too, but this one seemed particularly
generic) and replace repetitions overrides with using directives.
And simplify SmallVector::assign(num, element) while I'm here rather
than thrashing these files (that cause everyone to rebuild) again.
llvm-svn: 203374
diff --git a/llvm/unittests/ADT/SmallStringTest.cpp b/llvm/unittests/ADT/SmallStringTest.cpp
index 9398e99..ff04f5b 100644
--- a/llvm/unittests/ADT/SmallStringTest.cpp
+++ b/llvm/unittests/ADT/SmallStringTest.cpp
@@ -50,13 +50,6 @@
EXPECT_STREQ("aaa", theString.c_str());
}
-TEST_F(SmallStringTest, AssignIterPair) {
- StringRef abc = "abc";
- theString.assign(abc.begin(), abc.end());
- EXPECT_EQ(3u, theString.size());
- EXPECT_STREQ("abc", theString.c_str());
-}
-
TEST_F(SmallStringTest, AssignStringRef) {
StringRef abc = "abc";
theString.assign(abc);
@@ -88,6 +81,23 @@
EXPECT_STREQ("abcabc", theString.c_str());
}
+TEST_F(SmallStringTest, PlusEqualsStringRef) {
+ StringRef abc = "abc";
+ theString += abc;
+ theString += abc;
+ EXPECT_EQ(6u, theString.size());
+ EXPECT_STREQ("abcabc", theString.c_str());
+}
+
+TEST_F(SmallStringTest, PlusEqualsSmallVector) {
+ StringRef abc = "abc";
+ SmallVector<char, 10> abcVec(abc.begin(), abc.end());
+ theString += abcVec;
+ theString += abcVec;
+ EXPECT_EQ(6u, theString.size());
+ EXPECT_STREQ("abcabc", theString.c_str());
+}
+
TEST_F(SmallStringTest, AppendSmallVector) {
StringRef abc = "abc";
SmallVector<char, 10> abcVec(abc.begin(), abc.end());