forked from qt-creator/qt-creator
Utils: Add + operator to SmallString
It should not be used for chained concatenation. Use initializer list
instead.
auto text = in + 'x';
auto text = Utils::SmallString{in, "x", other, ", "};
Change-Id: I453d986913eae89fd5e1f525b9f4e0c4bd089467
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -1269,3 +1269,21 @@ TEST(SmallString, NumberToString)
|
||||
ASSERT_THAT(SmallString::number(1.2), "1.200000");
|
||||
ASSERT_THAT(SmallString::number(-1.2), "-1.200000");
|
||||
}
|
||||
|
||||
TEST(SmallString, StringViewPlusOperator)
|
||||
{
|
||||
SmallStringView text = "text";
|
||||
|
||||
auto result = text + " and more text";
|
||||
|
||||
ASSERT_THAT(result, "text and more text");
|
||||
}
|
||||
|
||||
TEST(SmallString, StringPlusOperator)
|
||||
{
|
||||
SmallString text = "text";
|
||||
|
||||
auto result = text + " and more text";
|
||||
|
||||
ASSERT_THAT(result, "text and more text");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user