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 <david.faure@kdab.com>
This commit is contained in:
Thiago Macieira 2014-08-01 19:01:48 -05:00
parent 86922b4655
commit d554fa6fdc

View File

@ -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