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.

Pick-to: 6.8 6.5 6.2
Change-Id: I9fb5fc07169d3fbd4699911853f25ef2ab559027
Reviewed-by: David Faure <david.faure@kdab.com>
This commit is contained in:
Marc Mutz 2024-10-24 14:11:57 +02:00
parent 07a0e4496d
commit 5e49278ab1

View File

@ -713,6 +713,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