From d554fa6fdcff40e38ab7fcfbd1249e25b89a8078 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 1 Aug 2014 19:01:48 -0500 Subject: Add unit tests for cleaning up nested functions I think supporting them now is too complex for the Qt code. We would probably need to rewrite the parser using a tokenizer so we can find the right name of the function. Just skipping backwards breaks the support for returning function pointers and PMFs. Change-Id: I78636437ecd46d77e6b9b013b2f2668cca1b6cd6 Reviewed-by: David Faure --- tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index ebfab643bd..0e35b28fda 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -242,6 +242,19 @@ public: int &operator--() { ADD("TestClass1::operator--"); return x; } int operator--(int) { ADD("TestClass1::operator--"); return 0; } + int nested_struct() + { + struct Nested { void nested() { ADD("TestClass1::nested_struct"); } }; + Nested().nested(); + return 0; + } + int nested_struct_const() const + { + struct Nested { void nested() { ADD("TestClass1::nested_struct_const"); } }; + Nested().nested(); + return 0; + } + #ifdef Q_COMPILER_REF_QUALIFIERS int lvalue() & { ADD("TestClass1::lvalue"); return 0; } int const_lvalue() const & { ADD("TestClass1::const_lvalue"); return 0; } @@ -308,6 +321,9 @@ public: operator--(); operator--(0); + nested_struct(); + nested_struct_const(); + #ifdef Q_COMPILER_REF_QUALIFIERS lvalue(); const_lvalue(); @@ -678,6 +694,8 @@ void tst_qmessagehandler::cleanupFuncinfo() // qDebug() << funcinfo.toLatin1(); QByteArray result = qCleanupFuncinfo(funcinfo.toLatin1()); + QEXPECT_FAIL("TestClass1::nested_struct", "Nested function processing is broken", Continue); + QEXPECT_FAIL("TestClass1::nested_struct_const", "Nested function processing is broken", Continue); QTEST(QString::fromLatin1(result), "expected"); } #endif -- cgit v1.2.3