Add zero-termination checks to QString and QByteArray tests
authorJoão Abecasis <joao.abecasis@nokia.com>
Tue, 3 Apr 2012 23:26:44 +0000 (01:26 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 5 Apr 2012 06:19:14 +0000 (08:19 +0200)
commitb143a65728fefd8d8f748e1cf984b38e0ca5b9bc
tree9d95925d16afdc842f5ad381bcb19031c18cd8b0
parente1626bf038d8ca8d968e7862bd8bced5c6cc2677
Add zero-termination checks to QString and QByteArray tests

This uses an alternative approach to the testing formerly introduced
in 4ef5a626. Zero-termination tests are injected into all QCOMPARE/QTEST
invocations. This makes such testing more thorough and widespread, and
gets seamlessly extended by future tests.

It also fixes an issue uncovered by the test where using a past-the-end
position with QString::insert(pos, char), could move uninitialized data
and clobber the null-terminator.

Change-Id: I7392580245b419ee65c3ae6f261b6e851d66dd4f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
src/corelib/tools/qstring.cpp
tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
tests/auto/corelib/tools/qstring/tst_qstring.cpp