diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/text/qstring/tst_qstring.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 8b9e762d5d..6a40d511e6 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -3505,6 +3505,16 @@ void tst_QString::erase() it = s.erase(s.begin(), s.begin() + 1); QCOMPARE_EQ(s, "b"); QCOMPARE(it, s.begin()); + + { + QString s1 = QLatin1String("house"); + QString copy = s1; + // erase() should return an iterator, not const_iterator + auto it = s1.erase(s1.cbegin(), s1.cbegin()); + *it = QLatin1Char('m'); + QCOMPARE(s1, "mouse"); + QCOMPARE(copy, "house"); + } } void tst_QString::toNum() |