From b441f9e5bb1cd7171029b579cecd1935268c33b5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 24 Oct 2024 14:11:57 +0200 Subject: [PATCH] tst_QDebug: extend test with pair The current std::pair streaming code supports this (and why shouldn't it?), so make sure follow-up refactorings won't change that. Amends 9b0970ad820c084b0fe73bcbbc72b44f04cae3dd. Conflict resolution for 6.8: - adjusted expected output to old-style (COMMMA w/o SP) pair formatting Pick-to: 6.5 6.2 Change-Id: I9fb5fc07169d3fbd4699911853f25ef2ab559027 Reviewed-by: David Faure (cherry picked from commit 5e49278ab168dbd31cefcdbdb930abac90d11621) Reviewed-by: Ivan Solovev --- tests/auto/corelib/io/qdebug/tst_qdebug.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp index f4faa12d6dd..c48223f57eb 100644 --- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp +++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp @@ -702,6 +702,15 @@ void tst_QDebug::qDebugStdPair() const // nested: qDebug() << std::pair(std::pair(std::pair(4.2, 42), ".42"), u"42"_s); QCOMPARE(s_msg, R"(std::pair(std::pair(std::pair(4.2,42),.42),"42"))"_L1); + // with references: + { + auto d = 4.2; auto i = 42; + qDebug() << std::pair(d, i); + QCOMPARE(s_msg, R"(std::pair(4.2,42))"_L1); + s_msg.clear(); // avoid False Positives (next line outputs same as prior) + qDebug() << std::pair(std::move(d), std::move(i)); + QCOMPARE(s_msg, R"(std::pair(4.2,42))"_L1); + } } void tst_QDebug::qDebugStdString() const