Bug 408020 - Suggest to use addRow instead of newRow+sprintf
Summary: Suggest to use addRow instead of newRow+sprintf
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-28 10:52 UTC by Giuseppe D'Angelo
Modified: 2019-09-01 13:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giuseppe D'Angelo 2019-05-28 10:52:15 UTC
Data-driven tests with QTest can use either newRow or addRow to add a new testdata row. Each data row has a unique data-tag used in logs, testrunners etc.

Sometimes this data-tag is generated procedurally:

  QTest::newRow(qPrintable(QString("Testing %1").arg(foo))) << foo;

However there's a better solution: QTest::addRow, which natively supports printf syntax:

  QTest::addRow("Testing %d", foo) << foo;

The idea is that this check should see if newRow is being used with qPrintable / QString::asprintf / etc. and suggest addRow instead.