diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-02-22 20:29:32 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-04-08 05:38:33 +0000 |
commit | 1ed8a7bff503aacf55f7f880ddaad461ea15e5e1 (patch) | |
tree | 06b264813602be5a9c442b3ba395e3b7227943a2 /src/testlib/qtest.h | |
parent | 3f41e8a2f51698d690a6b1f6a1f4acfe13ff50af (diff) |
QTest: support nullptr in QCOMPARE
This allows to write
QCOMPARE(ptr, nullptr);
instead of
QVERIFY(ptr);
Task-number: QTBUG-49973
Change-Id: I6e1327d4327bcf17bd9b59de4352fdcaae98ac27
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/testlib/qtest.h')
-rw-r--r-- | src/testlib/qtest.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 0c03ab620b..7352e89016 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -189,6 +189,11 @@ template<> inline char *toString(const QHostAddress &addr) } #endif +inline char *toString(std::nullptr_t) +{ + return toString(QLatin1String("nullptr")); +} + template<> inline bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual, const char *expected, const char *file, int line) |