diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2020-11-19 13:07:17 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-11-20 18:05:02 +0000 |
commit | 4cb21ded95a6fcb4b7accd9c43aa6ace40f8d02c (patch) | |
tree | 745a57c31a4e413446ff0ed46ef607100623cfe8 | |
parent | 7a6f6fb20f314a59d60fc83aa1faffe05066b9fe (diff) |
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.
Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
(cherry picked from commit 7b0fd207756d367db768c3cb546fa439c15bbac8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | tests/auto/corelib/text/qstring/tst_qstring.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index ab118deb90..04a4469a7d 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -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")); |