mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 10:07:41 +08:00
Fix Bug 30240 - std::string: append(first, last) error when aliasing. Add test cases for append/insert/assign/replace while we're at it, and fix a similar bug in insert.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@280643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -178,4 +178,21 @@ int main()
|
||||
test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter());
|
||||
}
|
||||
#endif
|
||||
|
||||
{ // test appending to self
|
||||
typedef std::string S;
|
||||
S s_short = "123/";
|
||||
S s_long = "Lorem ipsum dolor sit amet, consectetur/";
|
||||
|
||||
s_short.append(s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/");
|
||||
s_short.append(s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/123/123/");
|
||||
s_short.append(s_short.begin(), s_short.end());
|
||||
assert(s_short == "123/123/123/123/123/123/123/123/");
|
||||
|
||||
s_long.append(s_long.begin(), s_long.end());
|
||||
assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user