tst_QDebug: extend test with pair<references>

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 <david.faure@kdab.com>
(cherry picked from commit 5e49278ab168dbd31cefcdbdb930abac90d11621)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2024-10-24 14:11:57 +02:00
parent 35a0bfd1e3
commit b441f9e5bb

View File

@ -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<double &, const int &>(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<const double &&, int &&>(std::move(d), std::move(i));
QCOMPARE(s_msg, R"(std::pair(4.2,42))"_L1);
}
}
void tst_QDebug::qDebugStdString() const