forked from qt-creator/qt-creator
Utils: Add carriage return strip method to SmallString
Sometimes you want to compare unix and windows texts in tests. This is a convenient function to remove the carriage returns. Change-Id: I164298b70d3d775dd45903ea3753ac0e68ed2fdc Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -1050,3 +1050,12 @@ TEST(SmallString, ReplaceByPositionEqualSizedTexts)
|
||||
ASSERT_THAT(text, SmallString("this is very very very very very much text"));
|
||||
}
|
||||
|
||||
TEST(SmallString, CompareTextWithDifferentLineEndings)
|
||||
{
|
||||
SmallString unixText("some \ntext");
|
||||
SmallString windowsText("some \n\rtext");
|
||||
|
||||
auto convertedText = windowsText.toCarriageReturnsStripped();
|
||||
|
||||
ASSERT_THAT(unixText, convertedText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user