Add unit test for QString::replace with out-of-bounds position
QString::replace(pos, len, *unicode, size) can handle positions which are outside of the this-string. In that case, it is a no-op. Coverage analysis revealed we do not have a unit test for this. This patch adds one. Change-Id: Id4a407e860fff0d5c7c0a200c379e5e3961c86d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>bb10
parent
ebaae45ea1
commit
06f58a909b
|
|
@ -2748,6 +2748,16 @@ void tst_QString::replace_uint_uint_extra()
|
|||
s.replace( 0, 3, smallReplacement );
|
||||
QCOMPARE( s, smallReplacement );
|
||||
}
|
||||
|
||||
{
|
||||
QString s;
|
||||
s.insert(0, QLatin1String("BBB"));
|
||||
|
||||
auto smallReplacement = QString("C");
|
||||
|
||||
s.replace( 5, 3, smallReplacement );
|
||||
QCOMPARE( s, QLatin1String("BBB") );
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QString::replace_extra()
|
||||
|
|
|
|||
Loading…
Reference in New Issue