diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 2e70f3af9a3..4601c0391c3 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, ) 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");