From b83f104889ecf79e9ff0f5724774736bd21416c2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 10 Mar 2025 16:46:39 +0100 Subject: [PATCH] Extend tst_QByteArray::replaceWithEmptyNeedleInsertsBeforeEachChar() Add rows with needles and haystacks whole length is > 1 (to avoid only hitting paths that use single-char matching). Amends 5fc1e9fa0c1925654412af5bf46ff95da99bc190. Pick-to: 6.9 6.8 6.5 Reported-by: Ahman Samir Change-Id: Ie4c695f54d84cdb56b93fee6b7224d93faf00f75 Reviewed-by: Ahmad Samir --- .../auto/corelib/text/qbytearray/tst_qbytearray.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp index 6b09c270915..d8e7a1d2ef1 100644 --- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp @@ -1557,7 +1557,9 @@ void tst_QByteArray::replaceWithEmptyNeedleInsertsBeforeEachChar_data() const QByteArray a = "a"; const QByteArray aa = "aa"; const QByteArray b = "b"; + const QByteArray bb = "bb"; const QByteArray bab = "bab"; + const QByteArray babab = "babab"; auto row = [](const QByteArray &haystack, const QByteArray &needle, const QByteArray &replacement, const QByteArray &result) @@ -1569,12 +1571,23 @@ void tst_QByteArray::replaceWithEmptyNeedleInsertsBeforeEachChar_data() row(null, null, a, a); row(null, empty, a, a); row(null, a, a, null); + row(null, a, b, null); + row(null, aa, b, null); + row(empty, null, a, a); row(empty, empty, a, a); row(empty, a, a, empty); + row(empty, aa, b, empty); + row(a, null, b, bab); row(a, empty, b, bab); row(a, a, b, b); + row(a, aa, b, a); + + row(aa, null, b, babab); + row(aa, empty, b, babab); + row(aa, a, b, bb); + row(aa, aa, b, b); } void tst_QByteArray::replaceWithEmptyNeedleInsertsBeforeEachChar()