Add unit test for QString::insert(negativeint, QChar)

QString::insert(qsizetype, QChar) can insert at negative positions,
then counting from the end of the string. Coverage analysis revealed we
do not have a unit test for this. This patch adds a unit test.

Pick-to: 6.0
Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
Andreas Buhr 2020-11-19 13:07:17 +01:00
parent 756c4faccb
commit 7b0fd20775

View File

@ -2384,6 +2384,7 @@ void tst_QString::insert_special_cases()
QCOMPARE(a.insert(1,'e'), QString("Yes"));
QCOMPARE(a.insert(3,'!'), QString("Yes!"));
QCOMPARE(a.insert(5,'?'), QString("Yes! ?"));
QCOMPARE(a.insert(-1,'a'), QString("Yes! a?"));
a = "ABC";
QCOMPARE(a.insert(5,"DEF"), QString("ABC DEF"));