forked from qt-creator/qt-creator
Utils: Fix smallstring move assignment
Before the string was simply swapped with the other string which can lead to an unexpected behavior for xvalues. Now the destructor of the source is called and it is default initialized. foo = std::move(bar); bar would now hold the value of foo. Change-Id: Ibea3f18333a168634b7faf2fdaf9b5b52c82d5cc Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -1495,7 +1495,7 @@ TEST(SmallString, ShortSmallStringMoveAssignment)
|
||||
|
||||
copy = std::move(text);
|
||||
|
||||
ASSERT_THAT(text, SmallString("more text"));
|
||||
ASSERT_THAT(text, IsEmpty());
|
||||
ASSERT_THAT(copy, SmallString("text"));
|
||||
}
|
||||
|
||||
@@ -1506,7 +1506,7 @@ TEST(SmallString, LongSmallStringMoveAssignment)
|
||||
|
||||
copy = std::move(text);
|
||||
|
||||
ASSERT_THAT(text, SmallString("more text"));
|
||||
ASSERT_THAT(text, IsEmpty());
|
||||
ASSERT_THAT(copy, SmallString("this is a very very very very long text"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user