diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-06-17 11:52:22 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-06-17 11:52:22 +0000 |
commit | 5f6c7cfa931a9f9a154c67927f5dec7e928c23d6 (patch) | |
tree | 32a77288bc4247cbabf4a27ccd95a00036a7e618 /unittests | |
parent | 8dffa4a106b52d893388c94c24e365e14c468b7c (diff) |
SmallVector: return a valid iterator for the rare case of inserting an empty range into a SmallVector.
Patch by Johannes Schaub!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ADT/SmallVectorTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/ADT/SmallVectorTest.cpp b/unittests/ADT/SmallVectorTest.cpp index c2542d614e..8f6d2f4ac1 100644 --- a/unittests/ADT/SmallVectorTest.cpp +++ b/unittests/ADT/SmallVectorTest.cpp @@ -353,6 +353,9 @@ TEST_F(SmallVectorTest, InsertRepeatedTest) { makeSequence(theVector, 10, 15); theVector.insert(theVector.begin() + 1, 2, Constructable(16)); assertValuesInOrder(theVector, 8u, 10, 16, 16, 11, 12, 13, 14, 15); + + EXPECT_EQ(theVector.end(), + theVector.insert(theVector.end(), 0, Constructable(42))); } // Insert range. @@ -362,6 +365,10 @@ TEST_F(SmallVectorTest, InsertRangeTest) { makeSequence(theVector, 1, 3); theVector.insert(theVector.begin() + 1, 3, Constructable(77)); assertValuesInOrder(theVector, 6u, 1, 77, 77, 77, 2, 3); + + EXPECT_EQ(theVector.end(), theVector.insert(theVector.end(), + theVector.begin(), + theVector.begin())); } // Comparison tests. |