QByteArray: remove a unittest
It relied on an implementation detail of operator+=(), that the latter wouldn't just use assignement (e.g. if `this` is empty/null). It also had undefined behavior, when the char array used with fromRawData() went out of, the nested, scope, the code was pointing to a dangling stack pointer. Thanks to Thiago for the explanation in code review. This ties in with further changes in this series, where append() is changed to preserve null-ness; there is no way to preserve null-ness in append() while keeping this unittest passing. Change-Id: I43b9f60db9ce2d471f359f32bcc48e7b4cfceeab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d1da83002d18040f8ac21ebf6542ff71cb462509)
This commit is contained in:
parent
82e189441e
commit
f925278917
@ -78,7 +78,6 @@ private slots:
|
||||
void blockSizeCalculations();
|
||||
|
||||
void resizeAfterFromRawData();
|
||||
void appendAfterFromRawData();
|
||||
void toFromHex_data();
|
||||
void toFromHex();
|
||||
void toFromPercentEncoding();
|
||||
@ -1668,17 +1667,6 @@ void tst_QByteArray::resizeAfterFromRawData()
|
||||
QVERIFY(array.constData()[5] == 0);
|
||||
}
|
||||
|
||||
void tst_QByteArray::appendAfterFromRawData()
|
||||
{
|
||||
QByteArray arr;
|
||||
{
|
||||
char data[] = "X";
|
||||
arr += QByteArray::fromRawData(data, sizeof(data));
|
||||
data[0] = 'Y';
|
||||
}
|
||||
QCOMPARE(arr.at(0), 'X');
|
||||
}
|
||||
|
||||
void tst_QByteArray::toFromHex_data()
|
||||
{
|
||||
QTest::addColumn<QByteArray>("str");
|
||||
|
Loading…
x
Reference in New Issue
Block a user