[clazy] [Bug 408020] New: Suggest to use addRow instead of newRow+sprintf

Giuseppe D'Angelo bugzilla_noreply at kde.org
Tue May 28 11:52:15 BST 2019


https://bugs.kde.org/show_bug.cgi?id=408020

            Bug ID: 408020
           Summary: Suggest to use addRow instead of newRow+sprintf
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: dangelog at gmail.com
                CC: smartins at kde.org
  Target Milestone: ---

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list