diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-08-30 11:09:03 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-09-01 13:05:40 -0700 |
commit | 9e8c93fac10b802448b6b7938054220984734434 (patch) | |
tree | 3621c266058954a0d10a0df0b46227973714d919 /tests/auto/corelib/io/qfileinfo | |
parent | a15fef35ff9f78a2c16c31cc106175453d5ecfe0 (diff) |
tst_QFileInfo: replace a portion of a macro with a lambda
It's very hard to debug a macro.
Pick-to: 6.5 6.6
Change-Id: I2b24e1d3cad44897906efffd17803b8eac9bd844
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qfileinfo')
-rw-r--r-- | tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index fc5c8d3526..4b054c9056 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -2303,13 +2303,15 @@ void tst_QFileInfo::stdfilesystem() // We compare using absoluteFilePath since QFileInfo::operator== ends up using // canonicalFilePath which evaluates to empty-string for non-existent paths causing // these tests to always succeed. -#define COMPARE_CONSTRUCTION(filepath) \ - QCOMPARE(QFileInfo(fs::path(filepath)).absoluteFilePath(), \ - QFileInfo(QString::fromLocal8Bit(filepath)).absoluteFilePath()); \ - QCOMPARE(QFileInfo(base, fs::path(filepath)).absoluteFilePath(), \ - QFileInfo(base, QString::fromLocal8Bit(filepath)).absoluteFilePath()) - QDir base{ "../" }; // Used for the QFileInfo(QDir, <path>) ctor + auto doCompare = [&base](const char *filepath) { + QCOMPARE(QFileInfo(fs::path(filepath)).absoluteFilePath(), + QFileInfo(QString::fromLocal8Bit(filepath)).absoluteFilePath()); + QCOMPARE(QFileInfo(base, fs::path(filepath)).absoluteFilePath(), + QFileInfo(base, QString::fromLocal8Bit(filepath)).absoluteFilePath()); + }; +#define COMPARE_CONSTRUCTION(filepath) \ + doCompare(filepath); if (QTest::currentTestFailed()) return COMPARE_CONSTRUCTION("./file"); |