Utils: Enforce use of semicolon after QTC_ASSERT_EXPECTED

Change-Id: I2fe6b60434f251e4abf7a13a535844a10f99c6a3
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-01-10 08:01:50 +01:00
parent bf9e2110e6
commit ad2013eee5
2 changed files with 13 additions and 15 deletions

View File

@@ -31,17 +31,15 @@ constexpr unexpected<std::decay_t<E>> make_unexpected(E &&e)
//! If 'expected' has an error the error will be printed and the 'action' will be executed. //! If 'expected' has an error the error will be printed and the 'action' will be executed.
#define QTC_ASSERT_EXPECTED(expected, action) \ #define QTC_ASSERT_EXPECTED(expected, action) \
{ \ if (Q_LIKELY(expected)) { \
if (Q_LIKELY(expected)) { \ } else { \
} else { \ ::Utils::writeAssertLocation(QString("%1:%2: %3") \
::Utils::writeAssertLocation(QString("%1:%2: %3") \ .arg(__FILE__) \
.arg(__FILE__) \ .arg(__LINE__) \
.arg(__LINE__) \ .arg(expected.error()) \
.arg(expected.error()) \ .toUtf8() \
.toUtf8() \ .data()); \
.data()); \ action; \
action; \ } \
} \ do { \
do { \ } while (0)
} while (0); \
}

View File

@@ -180,7 +180,7 @@ static bool copyScriptTemplates(const SuiteConf &suiteConf, const Utils::FilePat
const Utils::FilePath testFile = destination.pathAppended("test" + extension); const Utils::FilePath testFile = destination.pathAppended("test" + extension);
QTC_ASSERT(!testFile.exists(), return false); QTC_ASSERT(!testFile.exists(), return false);
const Utils::expected_str<void> result = test.copyFile(testFile); const Utils::expected_str<void> result = test.copyFile(testFile);
QTC_ASSERT_EXPECTED(result, return false) QTC_ASSERT_EXPECTED(result, return false);
if (scripted) if (scripted)
ok = suiteConf.ensureObjectMapExists(); ok = suiteConf.ensureObjectMapExists();