From 1ed8a7bff503aacf55f7f880ddaad461ea15e5e1 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 22 Feb 2016 20:29:32 +0100 Subject: 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) --- src/testlib/qtest.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/testlib/qtest.h') 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) -- cgit v1.2.3