approvals / ApprovalTests.cpp.Qt

Apache License 2.0
14 stars 1 forks source link

If using Catch2, prevent QCOMPARE and similar from being used #6

Open claremacrae opened 3 years ago

claremacrae commented 3 years ago

Users need to know to avoid Qt Test macros in this project: QCOMPARE, QVERIFY, QTRY_COMPARE and so on

This is because any test failures will be silently swallowed, when the main() is written for Catch2 and not QtTest.

So tests will spuriously pass.

Fabial Kosmale at Qt provided some sample code to detect this at compile-time, which I have added here:

claremacrae/supercollider/testsuite/editors/sc-ide/common_test_code/safe_qcompare.h

claremacrae commented 2 years ago

There is a partial implementation of this, for QCOMPARE.