From 167316d7da34ea72b8f835647c2c13d1df3068a6 Mon Sep 17 00:00:00 2001 From: hjk <hjk121@nokiamail.com> Date: Mon, 28 Jan 2013 17:15:49 +0100 Subject: [PATCH] Debugger: Work on auto tests Change-Id: I21e783407a904de3501d0ac89d5f6f497ae4b1fe Reviewed-by: hjk <hjk121@nokiamail.com> --- tests/auto/debugger/tst_dumpers.cpp | 2308 ++++++++++++++------------- 1 file changed, 1222 insertions(+), 1086 deletions(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index fd89aef75b9..f3f2f0645de 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -40,27 +40,35 @@ using namespace Internal; static QByteArray noValue = "\001"; +static QByteArray nameFromIName(const QByteArray &iname) +{ + int pos = iname.lastIndexOf('.'); + return pos == -1 ? iname : iname.mid(pos + 1); +} + +static QByteArray parentIName(const QByteArray &iname) +{ + int pos = iname.lastIndexOf('.'); + return pos == -1 ? QByteArray() : iname.left(pos); +} + class Check { public: Check() {} + Check(const QByteArray &iname, const QByteArray &value, + const QByteArray &type) + : iname(iname), expectedName(nameFromIName(iname)), + expectedValue(value), expectedType(type) + {} + Check(const QByteArray &iname, const QByteArray &name, const QByteArray &value, const QByteArray &type) : iname(iname), expectedName(name), expectedValue(value), expectedType(type) {} - // Remove. - Check(const QByteArray &stuff) - { - QList<QByteArray> list = stuff.split(' '); - iname = list.value(0, QByteArray()); - expectedName = iname.mid(iname.lastIndexOf('.')); - expectedValue = list.value(1, QByteArray()); - expectedType = list.value(2, QByteArray()); - } - QByteArray iname; QByteArray expectedName; QByteArray expectedValue; @@ -75,14 +83,18 @@ public: : Check(iname, name, noValue, type) {} - CheckType(const QByteArray &stuff) - { - QList<QByteArray> list = stuff.split(' '); - iname = list.value(0, QByteArray()); - expectedName = iname.mid(iname.lastIndexOf('.')); - expectedValue = noValue; - expectedType = list.value(1, QByteArray()); - } + CheckType(const QByteArray &iname, const QByteArray &type) + : Check(iname, noValue, type) + {} +}; + +class Profile +{ +public: + Profile(const QByteArray &contents) : contents(contents) {} + +public: + QByteArray contents; }; class Data @@ -102,7 +114,14 @@ public: return *this; } + const Data &operator%(const Profile &profile) const + { + profileExtra += profile.contents; + return *this; + } + public: + mutable QByteArray profileExtra; QByteArray includes; QByteArray code; mutable QMap<QByteArray, Check> checks; @@ -141,12 +160,15 @@ void tst_Dumpers::dumper() ok = proFile.open(QIODevice::ReadWrite); QVERIFY(ok); proFile.write("SOURCES = main.cpp\nTARGET = doit\n"); + proFile.write(data.profileExtra); proFile.close(); QFile source(buildDir.path() + QLatin1String("/main.cpp")); ok = source.open(QIODevice::ReadWrite); QVERIFY(ok); - source.write(data.includes + + source.write( + "\n\nvoid dummyStatement(...) {}" + "\n\n" + data.includes + "\n\nvoid stopper() {}" "\n\nint main()" "\n{" @@ -184,9 +206,13 @@ void tst_Dumpers::dumper() QSet<QByteArray> expandedINames; expandedINames.insert("local"); foreach (const Check &check, data.checks) { - int pos = check.iname.lastIndexOf('.'); - if (pos != -1) - expandedINames.insert("local." + check.iname.left(pos)); + QByteArray parent = check.iname; + while (true) { + parent = parentIName(parent); + if (parent.isEmpty()) + break; + expandedINames.insert("local." + parent); + } } QByteArray expanded; @@ -273,20 +299,32 @@ void tst_Dumpers::dumper() foreach (const WatchData &item, list) { if (data.checks.contains(item.iname)) { Check check = data.checks.take(item.iname); - check.expectedType.replace("@NS@", nameSpace); + check.expectedValue.replace(' ', ""); + check.expectedType.replace('@', nameSpace); + check.expectedType.replace(' ', ""); + QByteArray actualValue = item.value.toLatin1(); + actualValue.replace(' ', ""); + QByteArray actualType = item.type; + actualType.replace(' ', ""); if (item.name.toLatin1() != check.expectedName) { + qDebug() << "INAME : " << item.iname; qDebug() << "NAME ACTUAL : " << item.name; qDebug() << "NAME EXPECTED: " << check.expectedName; + qDebug() << "CONTENTS : " << contents; QVERIFY(false); } - if (check.expectedValue != noValue && item.value.toLatin1() != check.expectedValue) { + if (check.expectedValue != noValue && actualValue != check.expectedValue) { + qDebug() << "INAME : " << item.iname; qDebug() << "VALUE ACTUAL : " << item.value; qDebug() << "VALUE EXPECTED: " << check.expectedValue; + qDebug() << "CONTENTS : " << contents; QVERIFY(false); } - if (check.expectedType != noValue && item.type != check.expectedType) { + if (check.expectedType != noValue && actualType != check.expectedType) { + qDebug() << "INAME : " << item.iname; qDebug() << "TYPE ACTUAL : " << item.type; qDebug() << "TYPE EXPECTED: " << check.expectedType; + qDebug() << "CONTENTS : " << contents; QVERIFY(false); } } @@ -296,6 +334,8 @@ void tst_Dumpers::dumper() qDebug() << "SOME TESTS NOT EXECUTED: "; foreach (const Check &check, data.checks) qDebug() << " TEST NOT FOUND FOR INAME: " << check.iname; + qDebug() << "CONTENTS : " << contents; + qDebug() << "EXPANDED : " << expanded; QVERIFY(false); } } @@ -304,10 +344,33 @@ void tst_Dumpers::dumper_data() { QTest::addColumn<Data>("data"); - QTest::newRow("QStringRef1") - << Data("QString str = \"Hello\";\n" - "QStringRef ref(&str, 1, 2);") - % Check("ref", "ref", "\"el\"", "@NS@QStringRef"); + QByteArray fooData = + "#include <QMap>\n" + "class Foo\n" + "{\n" + "public:\n" + " Foo(int i = 0)\n" + " : a(i), b(2)\n" + " {}\n" + " virtual ~Foo()\n" + " {\n" + " a = 5;\n" + " }\n" + " void doit()\n" + " {\n" + " static QObject ob;\n" + " m[\"1\"] = \"2\";\n" + " h[&ob] = m.begin();\n" + " --b;\n" + " }\n" + "public:\n" + " int a, b;\n" + " char x[6];\n" + "private:\n" + " typedef QMap<QString, QString> Map;\n" + " Map m;\n" + " QHash<QObject *, Map::iterator> h;\n" + "};"; QTest::newRow("AnonymousStruct") << Data("union {\n" @@ -316,25 +379,25 @@ void tst_Dumpers::dumper_data() " double d;\n" " } a = { { 42, 43 } };\n (void)a;") % CheckType("a", "a", "union {...}") - % Check("a.b", "b", "43", "int") - % Check("a.d", "d", "9.1245819032257467e-313", "double") - % Check("a.f", "f", "5.88545355e-44", "float") - % Check("a.i", "i", "42", "int"); + % Check("a.b", "43", "int") + % Check("a.d", "9.1245819032257467e-313", "double") + % Check("a.f", "5.88545355e-44", "float") + % Check("a.i", "42", "int"); QTest::newRow("QByteArray0") << Data("QByteArray ba;") - % Check("ba "" QByteArray"); + % Check("ba", "ba", "\"\"", "@QByteArray"); QTest::newRow("QByteArray1") - << Data("QByteArray ba = \"Hello\\\"World;\n" + << Data("QByteArray ba = \"Hello\\\"World\";\n" "ba += char(0);\n" "ba += 1;\n" "ba += 2;\n") - % Check("ba", "ba", "\"Hello\"World\"", "QByteArray") - % Check("ba.0", "0", "72 'H'", "char") - % Check("ba.11", "11", "0 '\0'", "char") - % Check("ba.12", "12", "1", "char") - % Check("ba.13", "13", "2", "char"); + % Check("ba", "\"Hello\"World\"", "@QByteArray") + % Check("ba.0", "[0]", "72", "char") + % Check("ba.11", "[11]", "0", "char") + % Check("ba.12", "[12]", "1", "char") + % Check("ba.13", "[13]", "2", "char"); QTest::newRow("QByteArray2") << Data("QByteArray ba;\n" @@ -342,9 +405,9 @@ void tst_Dumpers::dumper_data() " ba.append(char(i));\n" "QString s(10000, 'x');\n" "std::string ss(10000, 'c');") - % CheckType("ba", "ba", "QByteArray") - % Check("s", "s", QByteArray(10000, 'x'), "QByteArray") - % Check("ss", "ss", QByteArray(10000, 'c'), "QByteArray"); + % CheckType("ba", "@QByteArray") + % Check("s", '"' + QByteArray(10000, 'x') + '"', "@QString") + % Check("ss", '"' + QByteArray(10000, 'c') + '"', "std::string"); QTest::newRow("QByteArray3") << Data("const char *str1 = \"\356\";\n" @@ -353,77 +416,83 @@ void tst_Dumpers::dumper_data() "QByteArray buf1(str1);\n" "QByteArray buf2(str2);\n" "QByteArray buf3(str3);\n") - % Check("buf1", "buf1", "î", "QByteArray") - % Check("buf2", "buf2", "î", "QByteArray") - % Check("buf3", "buf3", "\ee", "QByteArray") - % CheckType("str1", "str1", "char *"); + % Check("buf1", "\"î\"", "@QByteArray") + % Check("buf2", "\"î\"", "@QByteArray") + % Check("buf3", "\"\ee\"", "@ByteArray") + % CheckType("str1", "char *"); QTest::newRow("QByteArray4") << Data("char data[] = { 'H', 'e', 'l', 'l', 'o' };\n" "QByteArray ba1 = QByteArray::fromRawData(data, 4);\n" "QByteArray ba2 = QByteArray::fromRawData(data + 1, 4);\n") - % Check("ba1", "ba1", "\"Hell\"", "QByteArray") - % Check("ba2", "ba2", "\"ello\"", "QByteArray"); + % Check("ba1", "\"Hell\"", "@QByteArray") + % Check("ba2", "\"ello\"", "@QByteArray"); QTest::newRow("QDate0") << Data("QDate date;\n") - % CheckType("date", "date", "QDate") - % Check("date.(ISO)", "date.(ISO)", "", "QString") - % Check("date.(Locale)", "date.(Locale)", "", "QString") - % Check("date.(SystemLocale)", "date.(SystemLocale)" ,"", "QString") - % Check("date.toString", "date.toString", "", "QString"); + % CheckType("date", "@QDate") + % Check("date.(ISO)", "", "@QString") + % Check("date.(Locale)", "", "@QString") + % Check("date.(SystemLocale)", "", "@QString") + % Check("date.toString", "", "@QString"); QTest::newRow("QDate1") << Data("QDate date;\n" "date.setDate(1980, 1, 1);\n") - % CheckType("date", "date", "QDate") - % Check("date.(ISO)", "date.(ISO)", "", "QString") - % Check("date.(Locale)", "date.(Locale)", "", "QString") - % Check("date.(SystemLocale)", "date.(SystemLocale)" ,"", "QString") - % Check("date.toString", "date.toString", "", "QString"); + % CheckType("date", "@QDate") + % Check("date.(ISO)", "\"1980-01-01\"", "@QString") + % CheckType("date.(Locale)", "@QString") + % CheckType("date.(SystemLocale)", "@QString") + % Check("date.toString", "\"Tue Jan 1 1980\"", "@QString"); QTest::newRow("QTime0") - << Data("QTime time;\n") - % CheckType("time QTime") - % Check("time.(ISO) "" QString") - % Check("time.(Locale) "" QString") - % Check("time.(SystemLocale) "" QString") - % Check("time.toString "" QString"); + << Data("#include <QTime>\n", + "QTime time;\n") + % CheckType("time", "@QTime") + % Check("time.(ISO)", "", "@QString") + % CheckType("time.(Locale)", "@QString") + % CheckType("time.(SystemLocale)", "@QString") + % Check("time.toString", "", "@QString"); QTest::newRow("QTime1") - << Data("QTime time;\n" - "time.setCurrentTime(12, 20, 20)\n") - % CheckType("time QTime") - % Check("time.(ISO) "" QString") - % Check("time.(Locale) "" QString") - % Check("time.(SystemLocale) "" QString") - % Check("time.toString "" QString"); + << Data("#include <QTime>\n", + "QTime time(13, 15, 32);") + % Check("time", "13:15:32", "@QTime") + % Check("time.(ISO)", "\"13:15:32\"", "@QString") + % CheckType("time.(Locale)", "@QString") + % CheckType("time.(SystemLocale)", "@QString") + % Check("time.toString", "\"13:15:32\"", "@QString"); QTest::newRow("QDateTime") - << Data("QDateTime date\n") - % CheckType("date QDateTime") - % Check("date.(ISO) "" QString") - % Check("date.(Locale) "" QString") - % Check("date.(SystemLocale) "" QString") - % Check("date.toString "" QString") - % Check("date.toUTC QDateTime"); + << Data("#include <QDateTime>\n", + "QDateTime date;\n") + % CheckType("date", "@QDateTime") + % Check("date.(ISO)", "", "@QString") + % Check("date.(Locale)", "", "@QString") + % Check("date.(SystemLocale)", "", "@QString") + % Check("date.toString", "\"\"", "@QString") + % Check("date.toUTC", "", "@QDateTime"); QTest::newRow("QDir") #ifdef Q_OS_WIN - << Data("QDir dir(\"C:\\\\Program Files\");") - % Check("dir", "C:/Program Files", "QDir") - % Check("dir.absolutePath", "C:/Program Files", "QString") - % Check("dir.canonicalPath", "C:/Program Files", "QString"); + << Data("#include <QDir>\n", + "QDir dir(\"C:\\\\Program Files\");") + % Check("dir", "C:/Program Files", "@QDir") + % Check("dir.absolutePath", "C:/Program Files", "@QString") + % Check("dir.canonicalPath", "C:/Program Files", "@QString"); #else - << Data("QDir dir(\"/tmp\");") - % Check("dir", "dir", "/tmp", "QDir") - % Check("dir.absolutePath", "absolutePath", "/tmp", "QString") - % Check("dir.canonicalPath", "canonicalPath", "/tmp", "QString"); + << Data("#include <QDir>\n", + "QDir dir(\"/tmp\"); QString s = dir.absolutePath();") + % Check("dir", "/tmp", "@QDir") + % Check("dir.absolutePath", "/tmp", "@QString") + % Check("dir.canonicalPath", "/tmp", "@QString"); #endif QTest::newRow("QFileInfo") #ifdef Q_OS_WIN - << Data("QFile file(\"C:\\\\Program Files\\t\");\n" + << Data("#include <QFile>\n" + "#include <QFileInfo>\n", + "QFile file(\"C:\\\\Program Files\\t\");\n" "file.setObjectName(\"A QFile instance\");\n" "QFileInfo fi(\"C:\\Program Files\\tt\");\n" "QString s = fi.absoluteFilePath();\n") @@ -431,36 +500,40 @@ void tst_Dumpers::dumper_data() % Check("file", "C:\Program Files\t", "QFile") % Check("s", "C:/Program Files/tt", "QString"); #else - << Data("QFile file(\"/tmp//t\");\n" + << Data("#include <QFile>\n" + "#include <QFileInfo>\n", + "QFile file(\"/tmp/t\");\n" "file.setObjectName(\"A QFile instance\");\n" "QFileInfo fi(\"/tmp/tt\");\n" "QString s = fi.absoluteFilePath();\n") - % Check("fi", "fi", "/tmp/tt", "QFileInfo") - % Check("file", "file", "/tmp/t", "QFile") - % Check("s", "s", "/tmp/tt", "QString"); + % Check("fi", "/tmp/tt", "@QFileInfo") + % Check("file", "/tmp/t", "@QFile") + % Check("s", "/tmp/tt", "@QString"); #endif QTest::newRow("QHash1") - << Data("QHash<QString, QList<int> > hash;\n" + << Data("#include <QHash>\n", + "QHash<QString, QList<int> > hash;\n" "hash.insert(\"Hallo\", QList<int>());\n" "hash.insert(\"Welt\", QList<int>() << 1);\n" "hash.insert(\"!\", QList<int>() << 1 << 2);\n") - % Check("hash", "hash", "<3 items>", "QHash<QString, QList<int>>") - % Check("hash.0", "0", "", "QHashNode<QString, QList<int>>") - % Check("hash.0.key", "key", "\"Hallo\"", "QString") - % Check("hash.0.value", "value", "<0 items>", "QList<int>") - % Check("hash.1", "1", "", "QHashNode<QString, QList<int>>") - % Check("hash.1.key", "key", "\"Welt\"", "QString") - % Check("hash.1.value", "value", "<1 items>", "QList<int>") + % Check("hash", "<3 items>", "@QHash<@QString, @QList<int> >") + % Check("hash.0", "[0]", "", "@QHashNode<@QString, @QList<int>>") + % Check("hash.0.key", "\"Hallo\"", "@QString") + % Check("hash.0.value", "<0 items>", "@QList<int>") + % Check("hash.1", "[1]", "", "@QHashNode<@QString, @QList<int>>") + % Check("hash.1.key", "key", "\"Welt\"", "@QString") + % Check("hash.1.value", "value", "<1 items>", "@QList<int>") % Check("hash.1.value.0", "0", "1", "int") - % Check("hash.2", "2", "", "QHashNode<QString, QList<int>>") - % Check("hash.2.key", "key", "\"!\"", "QString") - % Check("hash.2.value", "value", "<2 items>", "QList<int>") + % Check("hash.2", "[2]", "", "@QHashNode<@QString, @QList<int>>") + % Check("hash.2.key", "key", "\"!\"", "@QString") + % Check("hash.2.value", "value", "<2 items>", "@QList<int>") % Check("hash.2.value.0", "0", "1", "int") % Check("hash.2.value.1", "1", "2", "int"); QTest::newRow("QHash2") - << Data("QHash<int, float> hash;\n" + << Data("#include <QHash>\n", + "QHash<int, float> hash;\n" "hash[11] = 11.0;\n" "hash[22] = 22.0;\n") % Check("hash", "hash", "<2 items>", "QHash<int, float>") @@ -468,7 +541,8 @@ void tst_Dumpers::dumper_data() % Check("hash.11", "11", "11", "float"); QTest::newRow("QHash3") - << Data("QHash<QString, int> hash;\n" + << Data("#include <QHash>\n", + "QHash<QString, int> hash;\n" "hash[\"22.0\"] = 22.0;\n" "hash[\"123.0\"] = 22.0;\n" "hash[\"111111ss111128.0\"] = 28.0;\n" @@ -479,15 +553,16 @@ void tst_Dumpers::dumper_data() "hash[\"111111111128.0\"] = 28.0;\n" "hash[\"111111111111111111129.0\"] = 29.0;\n") % Check("hash", "hash", "<9 items>", "QHash<QString, int>") - % Check("hash.0", "0", "", "QHashNode<QString, int>") + % Check("hash.0", "0", "", "@QHashNode<QString, int>") % Check("hash.0.key", "key", "\"123.0\"", "QString") - % Check("hash.0.value 22 int") + % Check("hash.0.value", "22", "int") % Check("hash.8", "", "", "QHashNode<QString, int>") % Check("hash.8.key", "key", "\"11124.0\"", "QString") % Check("hash.8.value", "value", "22", "int"); QTest::newRow("QHash4") - << Data("QHash<QByteArray, float> hash;\n" + << Data("#include <QHash>\n", + "QHash<QByteArray, float> hash;\n" "hash[\"22.0\"] = 22.0;\n" "hash[\"123.0\"] = 22.0;\n" "hash[\"111111ss111128.0\"] = 28.0;\n" @@ -497,52 +572,56 @@ void tst_Dumpers::dumper_data() "hash[\"111111127.0\"] = 27.0;\n" "hash[\"111111111128.0\"] = 28.0;\n" "hash[\"111111111111111111129.0\"] = 29.0;\n") - % Check("hash <9 items> QHash<QByteArray, float>") - % Check("hash.0 QHashNode<QByteArray, float>") - % Check("hash.0.key \"123.0\" QByteArray") - % Check("hash.0.value 22 float") - % Check("hash.8 QHashNode<QByteArray, float>") - % Check("hash.8.key \"11124.0\" QByteArray") - % Check("hash.8.value 22 float"); + % Check("hash", "<9 items>", "@QHash<@QByteArray, float>") + % Check("hash.0", "[0]", "@QHashNode<@QByteArray, float>") + % Check("hash.0.key", "\"123.0\"", "@QByteArray") + % Check("hash.0.value", "22", "float") + % Check("hash.8", "[8]", "@QHashNode<@QByteArray, float>") + % Check("hash.8.key", "\"11124.0\"", "@QByteArray") + % Check("hash.8.value", "22", "float"); QTest::newRow("QHash5") - << Data("QHash<int, QString> hash;\n" + << Data("#include <QHash>\n", + "QHash<int, QString> hash;\n" "hash[22] = \"22.0\";\n") - % Check("hash <1 items> QHash<int, QString>") - % Check("hash.0 QHashNode<int, QString>") - % Check("hash.0.key 22 int") - % Check("hash.0.value \"22.0\" QString"); + % Check("hash", "<1 items>", "@QHash<int, @QString>") + % Check("hash.0", "", "@QHashNode<int, @QString>") + % Check("hash.0.key", "22", "int") + % Check("hash.0.value", "\"22.0\"", "@QString"); QTest::newRow("QHash6") - << Data("QHash<QString, Foo> hash;\n" + << Data("#include <QHash>\n" + fooData, + "QHash<QString, Foo> hash;\n" "hash[\"22.0\"] = Foo(22);\n" "hash[\"33.0\"] = Foo(33);\n") - % Check("hash <2 items> QHash<QString, Foo>") - % Check("hash.0 QHashNode<QString, Foo>") - % Check("hash.0.key \"22.0\" QString") - % CheckType("hash.0.value Foo") - % Check("hash.0.value.a 22 int") - % Check("hash.1 QHashNode<QString, Foo>") - % Check("hash.1.key \"33.0\" QString") - % CheckType("hash.1.value Foo"); + % Check("hash", "<2 items>", "@QHash<@QString, Foo>") + % Check("hash.0", "", "@QHashNode<@QString, Foo>") + % Check("hash.0.key", "\"22.0\"", "@QString") + % CheckType("hash.0.value", "Foo") + % Check("hash.0.value.a", "22", "int") + % Check("hash.1", "", "@QHashNode<@QString, Foo>") + % Check("hash.1.key", "\"33.0\"", "@QString") + % CheckType("hash.1.value", "Foo"); QTest::newRow("QHash7") - << Data("QObject ob;\n" + << Data("#include <QHash>\n", + "QObject ob;\n" "QHash<QString, QPointer<QObject> > hash;\n" "hash.insert(\"Hallo\", QPointer<QObject>(&ob));\n" "hash.insert(\"Welt\", QPointer<QObject>(&ob));\n" "hash.insert(\".\", QPointer<QObject>(&ob));\n") - % Check("hash <3 items> QHash<QString, QPointer<QObject>>") - % Check("hash.0 QHashNode<QString, QPointer<QObject>>") - % Check("hash.0.key \"Hallo\" QString") - % CheckType("hash.0.value QPointer<QObject>") - % CheckType("hash.0.value.o QObject") - % Check("hash.2 QHashNode<QString, QPointer<QObject>>") - % Check("hash.2.key \".\" QString") - % CheckType("hash.2.value QPointer<QObject>"); + % Check("hash", "<3 items>", "@QHash<@QString, @QPointer<@QObject>>") + % Check("hash.0", "", "@QHashNode<@QString, @QPointer<@QObject>>") + % Check("hash.0.key", "\"Hallo\"", "@QString") + % CheckType("hash.0.value", "@QPointer<QObject>") + % CheckType("hash.0.value.o", "@QObject") + % Check("hash.2", "", "@QHashNode<@QString, @QPointer<@QObject>>") + % Check("hash.2.key", "\".\"", "@QString") + % CheckType("hash.2.value", "@QPointer<@QObject>"); QTest::newRow("QHashIntFloatIterator") - << Data("typedef QHash<int, float> Hash;\n" + << Data("#include <QHash>\n", + "typedef QHash<int, float> Hash;\n" "Hash hash;\n" "hash[11] = 11.0;\n" "hash[22] = 22.0;\n" @@ -556,18 +635,20 @@ void tst_Dumpers::dumper_data() "Hash::iterator it4 = it3; ++it4;\n" "Hash::iterator it5 = it4; ++it5;\n" "Hash::iterator it6 = it5; ++it6;\n") - % Check("hash <6 items> qhash::Hash") - % Check("hash.11 11 float") - % Check("it1.key 55 int") - % Check("it1.value 55 float") - % Check("it6.key 33 int") - % Check("it6.value 33 float"); + % Check("hash", "<6 items>", "qhash::Hash") + % Check("hash.11", "11", "float") + % Check("it1.key", "55", "int") + % Check("it1.value", "55", "float") + % Check("it6.key", "33", "int") + % Check("it6.value", "33", "float"); QTest::newRow("QHostAddress") - << Data("QHostAddress ha1(129u * 256u * 256u * 256u + 130u);\n" + << Data("#include <QHostAddress>\n", + "QHostAddress ha1(129u * 256u * 256u * 256u + 130u);\n" "QHostAddress ha2(\"127.0.0.1\");\n") - % Check("ha1 129.0.0.130 QHostAddress") - % Check("ha2 \"127.0.0.1\" QHostAddress"); + % Profile("QT += network\n") + % Check("ha1", "129.0.0.130", "@QHostAddress") + % Check("ha2", "\"127.0.0.1\"", "@QHostAddress"); QTest::newRow("QImage") << Data("#include <QImage>\n" @@ -576,8 +657,8 @@ void tst_Dumpers::dumper_data() "im.fill(QColor(200, 100, 130).rgba());\n" "QPainter pain;\n" "pain.begin(&im);\n") - % Check("im (200x200) QImage") - % CheckType("pain QPainter"); + % Check("im", "(200x200)", "@QImage") + % CheckType("pain", "@QPainter"); QTest::newRow("QPixmap") << Data("#include <QImage>\n" @@ -591,71 +672,73 @@ void tst_Dumpers::dumper_data() "pain.drawLine(2, 2, 130, 130);\n" "pain.end();\n" "QPixmap pm = QPixmap::fromImage(im);\n") - % Check("im (200x200) QImage") - % CheckType("pain QPainter") - % Check("pm (200x200) QPixmap"); + % Check("im", "(200x200)", "@QImage") + % CheckType("pain", "@QPainter") + % Check("pm", "(200x200)", "@QPixmap"); QTest::newRow("QLinkedListInt") << Data("QLinkedList<int> list;\n" "list.append(101);\n" "list.append(102);\n") - % Check("list <2 items> QLinkedList<int>") - % Check("list.0 101 int") - % Check("list.1 102 int"); + % Check("list", "<2 items>", "@QLinkedList<int>") + % Check("list.0", "101", "int") + % Check("list.1", "102", "int"); QTest::newRow("QLinkedListUInt") << Data("QLinkedList<uint> list;\n" "list.append(103);\n" "list.append(104);\n") - % Check("list <2 items> QLinkedList<unsigned int>") - % Check("list.0 103 unsigned int") - % Check("list.1 104 unsigned int"); + % Check("list", "<2 items>", "@QLinkedList<unsigned int>") + % Check("list.0", "103", "unsigned int") + % Check("list.1", "104", "unsigned int"); QTest::newRow("QLinkedListFooStar") - << Data("QLinkedList<Foo *> list;\n" + << Data("#include <QLinkedList>\n" + fooData, + "QLinkedList<Foo *> list;\n" "list.append(new Foo(1));\n" "list.append(0);\n" "list.append(new Foo(3));\n") - % Check("list <3 items> QLinkedList<Foo*>") - % CheckType("list.0 Foo") - % Check("list.0.a 1 int") - % Check("list.1 0x0 Foo *") - % CheckType("list.2 Foo") - % Check("list.2.a 3 int"); + % Check("list", "<3 items>", "@QLinkedList<Foo*>") + % CheckType("list.0", "Foo") + % Check("list.0.a", "1", "int") + % Check("list.1", "0x0", "Foo *") + % CheckType("list.2", "Foo") + % Check("list.2.a", "3", "int"); QTest::newRow("QLinkedListULongLong") << Data("QLinkedList<qulonglong> list;\n" "list.append(42);\n" "list.append(43);\n") - % Check("list <2 items> QLinkedList<unsigned long long>") - % Check("list.0 42 unsigned long long") - % Check("list.1 43 unsigned long long"); + % Check("list", "<2 items>", "@QLinkedList<unsigned long long>") + % Check("list.0", "[0]", "42", "unsigned long long") + % Check("list.1", "[1]", "43", "unsigned long long"); QTest::newRow("QLinkedListFoo") - << Data("QLinkedList<Foo> list;\n" + << Data("#include <QLinkedList>\n" + fooData, + "QLinkedList<Foo> list;\n" "list.append(Foo(1));\n" "list.append(Foo(2));\n") - % Check("list <2 items> QLinkedList<Foo>") - % CheckType("list.0 Foo") - % Check("list.0.a 1 int") - % CheckType("list.1 Foo") - % Check("list.1.a 2 int"); + % Check("list", "<2 items>", "@QLinkedList<Foo>") + % CheckType("list.0", "[0]", "Foo") + % Check("list.0.a", "1", "int") + % CheckType("list.1", "[1]", "Foo") + % Check("list.1.a", "2", "int"); QTest::newRow("QLinkedListStdString") << Data("QLinkedList<std::string> list;\n" "list.push_back(\"aa\");\n" "list.push_back(\"bb\");\n") - % Check("list <2 items> QLinkedList<std::string>") - % Check("list.0 \"aa\" std::string") - % Check("list.1 \"bb\" std::string"); + % Check("list", "<2 items>", "@QLinkedList<std::string>") + % Check("list.0", "[0]", "\"aa\"", "std::string") + % Check("list.1", "[1]", "\"bb\"", "std::string"); QTest::newRow("QListInt") << Data("QList<int> big;\n" "for (int i = 0; i < 10000; ++i)\n" " big.push_back(i);\n") - % Check("big <10000 items> QList<int>") - % Check("big.0 0 int") - % Check("big.1999 1999 int"); + % Check("big", "<10000 items>", "@QList<int>") + % Check("big.0", "[0]", "0", "int") + % Check("big.1999", "[1999]", "1999", "int"); QTest::newRow("QListIntTakeFirst") << Data("QList<int> l;\n" @@ -663,8 +746,8 @@ void tst_Dumpers::dumper_data() "l.append(1);\n" "l.append(2);\n" "l.takeFirst();\n") - % Check("l <2 items> QList<int>") - % Check("l.0 1 int"); + % Check("l", "<2 items>", "@QList<int>") + % Check("l.0", "[0]", "1", "int"); QTest::newRow("QListStringTakeFirst") << Data("QList<QString> l;\n" @@ -672,8 +755,8 @@ void tst_Dumpers::dumper_data() "l.append(\"1\");\n" "l.append(\"2\");\n" "l.takeFirst();\n") - % Check("l <2 items> QList<QString>") - % Check("l.0 \"1\" QString"); + % Check("l", "<2 items>", "@QList<@QString>") + % Check("l.0", "\"1\"", "@QString"); QTest::newRow("QStringListTakeFirst") << Data("QStringList l;\n" @@ -681,58 +764,58 @@ void tst_Dumpers::dumper_data() "l.append(\"1\");\n" "l.append(\"2\");\n" "l.takeFirst();\n") - % Check("l <2 items> QStringList") - % Check("l.0 \"1\" QString"); + % Check("l", "<2 items>", "@QStringList") + % Check("l.0", "\"1\"", "@QString"); QTest::newRow("QListIntStar") << Data("QList<int *> l0, l;\n" "l.append(new int(1));\n" "l.append(new int(2));\n" "l.append(new int(3));\n") - % Check("l0 <0 items> QList<int*>") - % Check("l <3 items> QList<int*>") - % CheckType("l.0 int") - % CheckType("l.2 int"); + % Check("l0", "<0 items>", "@QList<int*>") + % Check("l", "<3 items>", "@QList<int*>") + % CheckType("l.0", "int") + % CheckType("l.2", "int"); QTest::newRow("QListUInt") << Data("QList<uint> l0,l;\n" "l.append(101);\n" "l.append(102);\n" "l.append(102);\n") - % Check("l0 <0 items> QList<unsigned int>") - % Check("l <3 items> QList<unsigned int>") - % Check("l.0 101 unsigned int") - % Check("l.2 102 unsigned int"); + % Check("l0", "<0 items>", "@QList<unsigned int>") + % Check("l", "<3 items>", "@QList<unsigned int>") + % Check("l.0", "101", "unsigned int") + % Check("l.2", "102", "unsigned int"); QTest::newRow("QListUShort") << Data("QList<ushort> l0,l;\n" "l.append(101);\n" "l.append(102);\n" "l.append(102);\n") - % Check("l0 <0 items> QList<unsigned short>") - % Check("l <3 items> QList<unsigned short>") - % Check("l.0 101 unsigned short") - % Check("l.2 102 unsigned short"); + % Check("l0", "<0 items>", "@QList<unsigned short>") + % Check("l", "<3 items>", "@QList<unsigned short>") + % Check("l.0", "101", "unsigned short") + % Check("l.2", "102", "unsigned short"); QTest::newRow("QListQChar") << Data("QList<QChar> l0, l;\n" "l.append(QChar('a'));\n" "l.append(QChar('b'));\n" "l.append(QChar('c'));\n") - % Check("l0 <0 items> QList<QChar>") - % Check("l <3 items> QList<QChar>") - % Check("l.0 'a' (97) QChar") - % Check("l.2 'c' (99) QChar"); + % Check("l0", "<0 items>", "@QList<@QChar>") + % Check("l", "<3 items>", "@QList<@QChar>") + % Check("l.0", "'a' (97)", "@QChar") + % Check("l.2", "'c' (99)", "@QChar"); QTest::newRow("QListQULongLong") << Data("QList<qulonglong> l0, l;\n" "l.append(101);\n" "l.append(102);\n" "l.append(102);\n") - % Check("l0 <0 items> QList<unsigned long long>") - % Check("l <3 items> QList<unsigned long long>") - % CheckType("l.0 unsigned long long") - % CheckType("l.2 unsigned long long"); + % Check("l0", "<0 items>", "@QList<unsigned long long>") + % Check("l", "<3 items>", "@QList<unsigned long long>") + % CheckType("l.0", "unsigned long long") + % CheckType("l.2", "unsigned long long"); QTest::newRow("QListStdString") << Data("QList<std::string> l0, l;\n" @@ -740,19 +823,20 @@ void tst_Dumpers::dumper_data() "l.push_back(\"bb\");\n" "l.push_back(\"cc\");\n" "l.push_back(\"dd\");") - % Check("l0 <0 items> QList<std::string>") - % Check("l <4 items> QList<std::string>") - % CheckType("l.0 std::string") - % CheckType("l.3 std::string"); + % Check("l0", "<0 items>", "@QList<std::string>") + % Check("l", "<4 items>", "@QList<std::string>") + % CheckType("l.0", "std::string") + % Check("l.3", "\"dd\"", "std::string"); QTest::newRow("QListFoo") - << Data("QList<Foo> l0, l;\n" + << Data("#include <QList>\n" + fooData, + "QList<Foo> l0, l;\n" "for (int i = 0; i < 100; ++i)\n" " l.push_back(i + 15);\n") - % Check("l0 <0 items> QList<Foo>") - % Check("l <100 items> QList<Foo>") - % CheckType("l.0 Foo") - % CheckType("l.99 Foo"); + % Check("l0", "<0 items>", "@QList<Foo>") + % Check("l", "<100 items>", "@QList<Foo>") + % Check("l.0", "", "Foo") + % Check("l.99", "", "Foo"); QTest::newRow("QListReverse") << Data("QList<int> l = QList<int>() << 1 << 2 << 3;\n" @@ -762,82 +846,83 @@ void tst_Dumpers::dumper_data() "QList<int> r;\n" "while (rit != rend)\n" " r.append(*rit++);\n") - % Check("l <3 items> QList<int>") - % Check("l.0 1 int") - % Check("l.1 2 int") - % Check("l.2 3 int") - % Check("r <3 items> QList<int>") - % Check("r.0 3 int") - % Check("r.1 2 int") - % Check("r.2 1 int") - % CheckType("rend qlist::Reverse") - % CheckType("rit qlist::Reverse"); + % Check("l", "<3 items>", "@QList<int>") + % Check("l.0", "1", "int") + % Check("l.1", "2", "int") + % Check("l.2", "3", "int") + % Check("r", "<3 items>", "@QList<int>") + % Check("r.0", "3", "int") + % Check("r.1", "2", "int") + % Check("r.2", "1", "int") + % Check("rend", "", "Reverse") + % Check("rit", "", "Reverse"); QTest::newRow("QLocale") << Data("QLocale loc = QLocale::system();\n" "QLocale::MeasurementSystem m = loc.measurementSystem();\n") - % CheckType("loc QLocale") - % CheckType("m QLocale::MeasurementSystem"); + % Check("loc", "", "@QLocale") + % Check("m", "", "@QLocale::MeasurementSystem"); QTest::newRow("QMapUIntStringList") << Data("QMap<uint, QStringList> map;\n" "map[11] = QStringList() << \"11\";\n" "map[22] = QStringList() << \"22\";\n") - % Check("map <2 items> QMap<unsigned int, QStringList>") - % Check("map.0 QMapNode<unsigned int, QStringList>") - % Check("map.0.key 11 unsigned int") - % Check("map.0.value <1 items> QStringList") - % Check("map.0.value.0 \"11\" QString") - % Check("map.1 QMapNode<unsigned int, QStringList>") - % Check("map.1.key 22 unsigned int") - % Check("map.1.value <1 items> QStringList") - % Check("map.1.value.0 \"22\" QString"); + % Check("map", "<2 items>", "@QMap<unsigned int, @QStringList>") + % Check("map.0", "", "@QMapNode<unsigned int, @QStringList>") + % Check("map.0.key", "11", "unsigned int") + % Check("map.0.value", "<1 items>", "@QStringList") + % Check("map.0.value.0", "\"11\"", "@QString") + % Check("map.1", "", "@QMapNode<unsigned int, @QStringList>") + % Check("map.1.key", "22", "unsigned int") + % Check("map.1.value", "<1 items>", "@QStringList") + % Check("map.1.value.0", "\"22\"", "@QString"); QTest::newRow("QMapUIntStringListTypedef") << Data("typedef QMap<uint, QStringList> T;\n" "T map;\n" "map[11] = QStringList() << \"11\";\n" "map[22] = QStringList() << \"22\";\n") - % Check("map <2 items> qmap::T"); + % Check("map", "<2 items>", "T"); QTest::newRow("QMapUIntFloat") << Data("QMap<uint, float> map;\n" "map[11] = 11.0;\n" "map[22] = 22.0;\n") - % Check("map <2 items> QMap<unsigned int, float>") - % Check("map.11 11 float") - % Check("map.22 22 float"); + % Check("map", "<2 items>", "@QMap<unsigned int, float>") + % Check("map.11", "11", "float") + % Check("map.22", "22", "float"); QTest::newRow("QMapStringFloat") << Data("QMap<QString, float> map;\n" "map[\"22.0\"] = 22.0;\n") - % Check("map <1 items> QMap<QString, float>") - % Check("map.0 QMapNode<QString, float>") - % Check("map.0.key \"22.0\" QString") - % Check("map.0.value 22 float"); + % Check("map", "<1 items>", "@QMap<@QString, float>") + % Check("map.0", "", "@QMapNode<@QString, float>") + % Check("map.0.key", "\"22.0\"", "@QString") + % Check("map.0.value", "22", "float"); QTest::newRow("QMapIntString") << Data("QMap<int, QString> map;\n" "map[22] = \"22.0\";\n") - % Check("map <1 items> QMap<int, QString>") - % Check("map.0 QMapNode<int, QString>") - % Check("map.0.key 22 int") - % Check("map.0.value \"22.0\" QString"); + % Check("map", "<1 items>", "@QMap<int, @QString>") + % Check("map.0", "", "@QMapNode<int, @QString>") + % Check("map.0.key", "22", "int") + % Check("map.0.value", "\"22.0\"", "@QString"); QTest::newRow("QMapStringFoo") - << Data("QMap<QString, Foo> map;\n" + << Data("#include <QMap>\n" + fooData, + "QMap<QString, Foo> map;\n" "map[\"22.0\"] = Foo(22);\n" "map[\"33.0\"] = Foo(33);\n") - % Check("map <2 items> QMap<QString, Foo>") - % Check("map.0 QMapNode<QString, Foo>") - % Check("map.0.key \"22.0\" QString") - % CheckType("map.0.value Foo") - % Check("map.0.value.a 22 int") - % Check("map.1 QMapNode<QString, Foo>") - % Check("map.1.key \"33.0\" QString") - % CheckType("map.1.value Foo") - % Check("map.1.value.a 33 int"); + % Check("map", "<2 items>", "@QMap<@QString, Foo>") + % Check("map.0", "", "@QMapNode<@QString, Foo>") + % Check("map.0.key", "\"22.0\"", "@QString") + % Check("map.0.value", "", "Foo") + % Check("map.0.value.a", "22", "int") + % Check("map.1", "", "@QMapNode<@QString, Foo>") + % Check("map.1.key", "\"33.0\"", "@QString") + % Check("map.1.value", "", "Foo") + % Check("map.1.value.a", "33", "int"); QTest::newRow("QMapStringPointer") << Data("QObject ob;\n" @@ -845,15 +930,15 @@ void tst_Dumpers::dumper_data() "map.insert(\"Hallo\", QPointer<QObject>(&ob));\n" "map.insert(\"Welt\", QPointer<QObject>(&ob));\n" "map.insert(\".\", QPointer<QObject>(&ob));\n") - % Check("map <3 items> QMap<QString, QPointer<QObject>>") - % Check("map.0 QMapNode<QString, QPointer<QObject>>") - % Check("map.0.key \".\" QString") - % CheckType("map.0.value QPointer<QObject>") - % CheckType("map.0.value.o QObject") - % Check("map.1 QMapNode<QString, QPointer<QObject>>") - % Check("map.1.key \"Hallo\" QString") - % Check("map.2 QMapNode<QString, QPointer<QObject>>") - % Check("map.2.key \"Welt\" QString"); + % Check("map", "<3 items>", "@QMap<@QString, @QPointer<@QObject>>") + % Check("map.0", "", "@QMapNode<@QString, @QPointer<@QObject>>") + % Check("map.0.key", ".", "@QString") + % Check("map.0.value", "", "@QPointer<@QObject>") + % Check("map.0.value.o", "", "@QObject") + % Check("map.1", "", "@QMapNode<@QString, @QPointer<@QObject>>") + % Check("map.1.key", "\"Hallo\"", "@QString") + % Check("map.2", "", "@QMapNode<@QString, @QPointer<@QObject>>") + % Check("map.2.key", "\"Welt\"", "@QString"); QTest::newRow("QMapStringList") << Data("QList<nsA::nsB::SomeType *> x;\n" @@ -865,22 +950,22 @@ void tst_Dumpers::dumper_data() "map[\"bar\"] = x;\n" "map[\"1\"] = x;\n" "map[\"2\"] = x;\n") - % Check("map <4 items> QMap<QString, QList<nsA::nsB::SomeType*>>") - % Check("map.0 QMapNode<QString, QList<nsA::nsB::SomeType*>>") - % Check("map.0.key \"1\" QString") - % Check("map.0.value <3 items> QList<nsA::nsB::SomeType*>") - % CheckType("map.0.value.0 nsA::nsB::SomeType") - % Check("map.0.value.0.a 1 int") - % CheckType("map.0.value.1 nsA::nsB::SomeType") - % Check("map.0.value.1.a 2 int") - % CheckType("map.0.value.2 nsA::nsB::SomeType") - % Check("map.0.value.2.a 3 int") - % Check("map.3 QMapNode<QString, QList<nsA::nsB::SomeType*>>") - % Check("map.3.key \"foo\" QString") - % Check("map.3.value <3 items> QList<nsA::nsB::SomeType*>") - % CheckType("map.3.value.2 nsA::nsB::SomeType") - % Check("map.3.value.2.a 3 int") - % Check("x <3 items> QList<nsA::nsB::SomeType*>"); + % Check("map", "<4 items>", "@QMap<@QString, @QList<nsA::nsB::SomeType*>>") + % Check("map.0", "", "@QMapNode<@QString, @QList<nsA::nsB::SomeType*>>") + % Check("map.0.key", "\"1\"", "@QString") + % Check("map.0.value", "<3 items>", "@QList<nsA::nsB::SomeType*>") + % Check("map.0.value.0", "", "nsA::nsB::SomeType") + % Check("map.0.value.0.a", "1", "int") + % Check("map.0.value.1", "", "nsA::nsB::SomeType") + % Check("map.0.value.1.a", "2", "int") + % Check("map.0.value.2", "", "nsA::nsB::SomeType") + % Check("map.0.value.2.a", "3", "int") + % Check("map.3", "", "@QMapNode<@QString, QList<nsA::nsB::SomeType*>>") + % Check("map.3.key", "\"foo\"", "@QString") + % Check("map.3.value", "<3 items>", "@QList<nsA::nsB::SomeType*>") + % Check("map.3.value.2", "", "nsA::nsB::SomeType") + % Check("map.3.value.2.a", "3", "int") + % Check("x", "<3 items>", "@QList<nsA::nsB::SomeType*>"); QTest::newRow("QMultiMapUintFloat") << Data("QMultiMap<uint, float> map;\n" @@ -890,67 +975,68 @@ void tst_Dumpers::dumper_data() "map.insert(22, 34.0);\n" "map.insert(22, 35.0);\n" "map.insert(22, 36.0);\n") - % Check("map <6 items> QMultiMap<unsigned int, float>") - % Check("map.0 11 float") - % Check("map.5 22 float"); + % Check("map", "<6 items>", "@QMultiMap<unsigned int, float>") + % Check("map.0", "11", "float") + % Check("map.5", "22", "float"); QTest::newRow("QMultiMapStringFloat") << Data("QMultiMap<QString, float> map;\n" "map.insert(\"22.0\", 22.0);\n") - % Check("map <1 items> QMultiMap<QString, float>") - % Check("map.0 QMapNode<QString, float>") - % Check("map.0.key \"22.0\" QString") - % Check("map.0.value 22 float"); + % Check("map", "<1 items>", "@QMultiMap<@QString, float>") + % Check("map.0", "", "@QMapNode<@QString, float>") + % Check("map.0.key", "\"22.0\"", "@QString") + % Check("map.0.value", "22", "float"); QTest::newRow("QMultiMapIntString") << Data("QMultiMap<int, QString> map;\n" "map.insert(22, \"22.0\");\n") - % Check("map <1 items> QMultiMap<int, QString>") - % Check("map.0 QMapNode<int, QString>") - % Check("map.0.key 22 int") - % Check("map.0.value \"22.0\" QString"); + % Check("map", "<1 items>", "@QMultiMap<int, @QString>") + % Check("map.0", "", "@QMapNode<int, @QString>") + % Check("map.0.key", "22", "int") + % Check("map.0.value", "\"22.0\"", "@QString"); QTest::newRow("QMultiMapStringFoo") - << Data("QMultiMap<QString, Foo> map;\n" + << Data("#include <QMultiMap>\n" + fooData, + "QMultiMap<QString, Foo> map;\n" "map.insert(\"22.0\", Foo(22));\n" "map.insert(\"33.0\", Foo(33));\n" "map.insert(\"22.0\", Foo(22));\n") - % Check("map <3 items> QMultiMap<QString, Foo>") - % Check("map.0 QMapNode<QString, Foo>") - % Check("map.0.key \"22.0\" QString") - % CheckType("map.0.value Foo") - % Check("map.0.value.a 22 int") - % Check("map.2 QMapNode<QString, Foo>"); - - QTest::newRow("QMultiMapStringPointer") - << Data("QObject ob;\n" - "QMultiMap<QString, QPointer<QObject> > map;\n" - "map.insert(\"Hallo\", QPointer<QObject>(&ob));\n" - "map.insert(\"Welt\", QPointer<QObject>(&ob));\n" - "map.insert(\".\", QPointer<QObject>(&ob));\n" - "map.insert(\".\", QPointer<QObject>(&ob));\n") - % Check("map <4 items> QMultiMap<QString, QPointer<QObject>>") - % Check("map.0 QMapNode<QString, QPointer<QObject>>") - % Check("map.0.key \".\" QString") - % CheckType("map.0.value QPointer<QObject>") - % Check("map.1 QMapNode<QString, QPointer<QObject>>") - % Check("map.1.key \".\" QString") - % Check("map.2 QMapNode<QString, QPointer<QObject>>") - % Check("map.2.key \"Hallo\" QString") - % Check("map.3 QMapNode<QString, QPointer<QObject>>") - % Check("map.3.key \"Welt\" QString"); - - - QTest::newRow("QObject1") - << Data("QObject parent;\n" - "parent.setObjectName(\"A Parent\");\n" - "QObject child(&parent);\n" - "child.setObjectName(\"A Child\");\n" - "QObject::connect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));\n" - "QObject::disconnect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));\n" - "child.setObjectName(\"A renamed Child\");\n") - % Check("child \"A renamed Child\" QObject") - % Check("parent \"A Parent\" QObject"); + % Check("map", "<3 items>", "@QMultiMap<@QString, Foo>") + % Check("map.0", "", "@QMapNode<@QString, Foo>") + % Check("map.0.key", "\"22.0\"", "@QString") + % Check("map.0.value", "", "Foo") + % Check("map.0.value.a", "22", "int") + % Check("map.2", "", "@QMapNode<@QString, Foo>"); + + QTest::newRow("QMultiMapStringPointer") + << Data("QObject ob;\n" + "QMultiMap<QString, QPointer<QObject> > map;\n" + "map.insert(\"Hallo\", QPointer<QObject>(&ob));\n" + "map.insert(\"Welt\", QPointer<QObject>(&ob));\n" + "map.insert(\".\", QPointer<QObject>(&ob));\n" + "map.insert(\".\", QPointer<QObject>(&ob));\n") + % Check("map", "<4 items>", "@QMultiMap<@QString, @QPointer<@QObject>>") + % Check("map.0", "", "@QMapNode<@QString, @QPointer<@QObject>>") + % Check("map.0.key", "\".\"", "@QString") + % Check("map.0.value", "", "@QPointer<@QObject>") + % Check("map.1", "", "@QMapNode<@QString, @QPointer<@QObject>>") + % Check("map.1.key", "\".\"", "@QString") + % Check("map.2", "", "@QMapNode<@QString, @QPointer<@QObject>>") + % Check("map.2.key", "\"Hallo\"", "@QString") + % Check("map.3", "", "@QMapNode<@QString, @QPointer<@QObject>>") + % Check("map.3.key", "\"Welt\"", "@QString"); + + + QTest::newRow("QObject1") + << Data("QObject parent;\n" + "parent.setObjectName(\"A Parent\");\n" + "QObject child(&parent);\n" + "child.setObjectName(\"A Child\");\n" + "QObject::connect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));\n" + "QObject::disconnect(&child, SIGNAL(destroyed()), &parent, SLOT(deleteLater()));\n" + "child.setObjectName(\"A renamed Child\");\n") + % Check("child", "\"A renamed Child\"", "@QObject") + % Check("parent", "\"A Parent\"", "@QObject"); QByteArray objectData = " namespace Names {\n" @@ -998,8 +1084,8 @@ void tst_Dumpers::dumper_data() "test.setMyProp2(\"WORLD\");\n" "QString s = test.myProp1();\n" "s += test.myProp2();\n") - % Check("s \"HELLOWORLD\" QString") - % Check("test qobject::Names::Bar::TestObject"); + % Check("s", "\"HELLOWORLD\"", "@QString") + % Check("test", "", "Names::Bar::TestObject"); //" #if 1\n" //" #if USE_GUILIB\n" @@ -1137,7 +1223,7 @@ void tst_Dumpers::dumper_data() << Data(derivedData, "DerivedObject ob;\n" "ob.setX(26);\n") - % Check("ob.properties.x 26 QVariant (int)"); + % Check("ob.properties.x", "26", "@QVariant (int)"); QTest::newRow("QRegExp") @@ -1146,47 +1232,47 @@ void tst_Dumpers::dumper_data() "QString str2 = \"Xa1121b344c\";\n" "int pos2 = re.indexIn(str2);\n" "int pos1 = re.indexIn(str1);\n") - % Check("re \"a(.*)b(.*)c\" QRegExp") - % Check("str1 \"a1121b344c\" QString") - % Check("str2 \"Xa1121b344c\" QString") - % Check("pos1 0 int") - % Check("pos2 1 int"); + % Check("re", "\"a(.*)b(.*)c\"", "@QRegExp") + % Check("str1", "\"a1121b344c\"", "@QString") + % Check("str2", "\"Xa1121b344c\"", "@QString") + % Check("pos1", "0", "int") + % Check("pos2", "1", "int"); QTest::newRow("QPoint") << Data("QPoint s0, s;\n" "s = QPoint(100, 200);\n") - % Check("s (0, 0) QPoint") - % Check("s (100, 200) QPoint"); + % Check("s0", "(0, 0)", "@QPoint") + % Check("s", "(100, 200)", "@QPoint"); QTest::newRow("QPointF") << Data("QPointF s0, s;\n" "s = QPointF(100, 200);\n") - % Check("s (0, 0) QPointF") - % Check("s (100, 200) QPointF"); + % Check("s0", "(0, 0)", "@QPointF") + % Check("s", "(100, 200)", "@QPointF"); QTest::newRow("QRect") << Data("QRect rect0, rect;\n" "rect = QRect(100, 100, 200, 200);\n") - % Check("rect 0x0+0+0 QRect") - % Check("rect 200x200+100+100 QRect"); + % Check("rect", "0x0+0+0", "QRect") + % Check("rect", "200x200+100+100", "QRect"); QTest::newRow("QRectF") << Data("QRectF rect0, rect;\n" "rect = QRectF(100, 100, 200, 200);\n") - % Check("rect 0x0+0+0 QRectF") - % Check("rect 200x200+100+100 QRectF"); + % Check("rect", "0x0+0+0", "QRectF") + % Check("rect", "200x200+100+100", "QRectF"); QTest::newRow("QSize") << Data("QSize s0, s;\n" "s = QSize(100, 200);\n") - % Check("s (-1, -1) QSize") - % Check("s (100, 200) QSize"); + % Check("s0", "(-1, -1)", "@QSize") + % Check("s", "(100, 200)", "@QSize"); QTest::newRow("QSizeF") << Data("QSizeF s0, s;\n" "s = QSizeF(100, 200);\n") - % Check("s0 (-1, -1) QSizeF") - % Check("s (100, 200) QSizeF"); + % Check("s0", "(-1, -1)", "@QSizeF") + % Check("s", "(100, 200)", "@QSizeF"); QTest::newRow("QRegion") << Data("QRegion region, region0, region1, region2, region4;\n" @@ -1196,50 +1282,50 @@ void tst_Dumpers::dumper_data() "region1 = region;\n" "region += QRect(500, 500, 600, 600);\n" "region2 = region;\n") - % Check("region <empty> QRegion") - % Check("region <1 items> QRegion") - % CheckType("region.extents QRect") - % Check("region.innerArea 40000 int") - % CheckType("region.innerRect QRect") - % Check("region.numRects 1 int") - % Check("region.rects <0 items> QVector<QRect>") - % Check("region <2 items> QRegion") - % CheckType("region.extents QRect") - % Check("region.innerArea 200000 int") - % CheckType("region.innerRect QRect") - % Check("region.numRects 2 int") - % Check("region.rects <2 items> QVector<QRect>") - % Check("region <4 items> QRegion") - % CheckType("region.extents QRect") - % Check("region.innerArea 360000 int") - % CheckType("region.innerRect QRect") - % Check("region.numRects 4 int") - % Check("region.rects <8 items> QVector<QRect>") - % Check("region <4 items> QRegion"); + % Check("region", "<empty>", "@QRegion") + % Check("region", "<1 items>", "@QRegion") + % Check("region.extents", "", "@QRect") + % Check("region.innerArea", "40000", "int") + % Check("region.innerRect", "", "@QRect") + % Check("region.numRects", "1", "int") + % Check("region.rects", "<0 items>", "@QVector<@QRect>") + % Check("region", "<2 items>", "@QRegion") + % Check("region.extents", "", "@QRect") + % Check("region.innerArea", "200000", "int") + % Check("region.innerRect", "", "@QRect") + % Check("region.numRects", "2", "int") + % Check("region.rects", "<2 items>", "@QVector<@QRect>") + % Check("region", "<4 items>", "@QRegion") + % Check("region.extents", "", "@QRect") + % Check("region.innerArea", "360000", "int") + % Check("region.innerRect", "", "@QRect") + % Check("region.numRects", "4", "int") + % Check("region.rects", "<8 items>", "@QVector<@QRect>") + % Check("region", "<4 items>", "@QRegion"); QTest::newRow("QSettings") << Data("QCoreApplication app(argc, argv);\n" "QSettings settings(\"/tmp/test.ini\", QSettings::IniFormat);\n" "QVariant value = settings.value(\"item1\", \"\").toString();\n") - % Check("settings QSettings") - % Check("settings.@1 "" QObject") - % Check("value "" QVariant (QString)"); + % Check("settings", "", "@QSettings") + % Check("settings.@1", "", "@QObject") + % Check("value", "", "@QVariant (QString)"); QTest::newRow("QSet1") << Data("QSet<int> s;\n" "s.insert(11);\n" "s.insert(22);\n") - % Check("s <2 items> QSet<int>") - % Check("s.22 22 int") - % Check("s.11 11 int"); + % Check("s", "<2 items>", "@QSet<int>") + % Check("s.22", "22", "int") + % Check("s.11", "11", "int"); QTest::newRow("QSet2") << Data("QSet<QString> s;\n" "s.insert(\"11.0\");\n" "s.insert(\"22.0\");\n") - % Check("s <2 items> QSet<QString>") - % Check("s.0 \"11.0\" QString") - % Check("s.1 \"22.0\" QString"); + % Check("s", "<2 items>", "@QSet<@QString>") + % Check("s.0", "\"11.0\"", "@QString") + % Check("s.1", "\"22.0\"", "@QString"); QTest::newRow("QSet3") << Data("QObject ob;\n" @@ -1248,8 +1334,8 @@ void tst_Dumpers::dumper_data() "s.insert(ptr);\n" "s.insert(ptr);\n" "s.insert(ptr);\n") - % Check("s <1 items> QSet<QPointer<QObject>>") - % CheckType("s.0 QPointer<QObject>"); + % Check("s", "<1 items>", "@QSet<@QPointer<@QObject>>") + % Check("s.0", "", "@QPointer<@QObject>"); QByteArray sharedData = @@ -1311,7 +1397,8 @@ void tst_Dumpers::dumper_data() "QWeakPointer<QString> ptr3 = ptr;\n"); QTest::newRow("QSharedPointer5") - << Data("QSharedPointer<Foo> fptr(new Foo(1));\n" + << Data("#include <QSharedPointer>\n" + fooData, + "QSharedPointer<Foo> fptr(new Foo(1));\n" "QWeakPointer<Foo> ptr(fptr);\n" "QWeakPointer<Foo> ptr2 = ptr;\n" "QWeakPointer<Foo> ptr3 = ptr;\n"); @@ -1321,43 +1408,43 @@ void tst_Dumpers::dumper_data() "atts.append(\"name1\", \"uri1\", \"localPart1\", \"value1\");\n" "atts.append(\"name2\", \"uri2\", \"localPart2\", \"value2\");\n" "atts.append(\"name3\", \"uri3\", \"localPart3\", \"value3\");\n") - % CheckType("atts QXmlAttributes") - % CheckType("atts.[vptr] ") - % Check("atts.attList <3 items> QXmlAttributes::AttributeList") - % CheckType("atts.attList.0 QXmlAttributes::Attribute") - % Check("atts.attList.0.localname \"localPart1\" QString") - % Check("atts.attList.0.qname \"name1\" QString") - % Check("atts.attList.0.uri \"uri1\" QString") - % Check("atts.attList.0.value \"value1\" QString") - % CheckType("atts.attList.1 QXmlAttributes::Attribute") - % Check("atts.attList.1.localname \"localPart2\" QString") - % Check("atts.attList.1.qname \"name2\" QString") - % Check("atts.attList.1.uri \"uri2\" QString") - % Check("atts.attList.1.value \"value2\" QString") - % CheckType("atts.attList.2 QXmlAttributes::Attribute") - % Check("atts.attList.2.localname \"localPart3\" QString") - % Check("atts.attList.2.qname \"name3\" QString") - % Check("atts.attList.2.uri \"uri3\" QString") - % Check("atts.attList.2.value \"value3\" QString") - % CheckType("atts.d QXmlAttributesPrivate"); + % Check("atts", "", "QXmlAttributes") + % CheckType("atts.[vptr]", "") + % Check("atts.attList", "<3 items>", "@QXmlAttributes::AttributeList") + % Check("atts.attList.0", "", "QXmlAttributes::Attribute") + % Check("atts.attList.0.localname", "\"localPart1\"", "@QString") + % Check("atts.attList.0.qname", "\"name1\"", "@QString") + % Check("atts.attList.0.uri", "\"uri1\"", "@QString") + % Check("atts.attList.0.value", "\"value1\"", "@QString") + % Check("atts.attList.1", "", "@QXmlAttributes::Attribute") + % Check("atts.attList.1.localname", "\"localPart2\"", "@QString") + % Check("atts.attList.1.qname", "\"name2\"", "@QString") + % Check("atts.attList.1.uri", "\"uri2\"", "@QString") + % Check("atts.attList.1.value", "\"value2\"", "@QString") + % Check("atts.attList.2", "", "@QXmlAttributes::Attribute") + % Check("atts.attList.2.localname", "\"localPart3\"", "@QString") + % Check("atts.attList.2.qname", "\"name3\"", "@QString") + % Check("atts.attList.2.uri", "\"uri3\"", "@QString") + % Check("atts.attList.2.value", "\"value3\"", "@QString") + % Check("atts.d", "", "@QXmlAttributesPrivate"); QTest::newRow("StdArray") << Data("std::array<int, 4> a = { { 1, 2, 3, 4} };\n" "std::array<QString, 4> b = { { \"1\", \"2\", \"3\", \"4\"} };\n") - % Check("a <4 items> std::array<int, 4u>") - % Check("a <4 items> std::array<QString, 4u>"); + % Check("a", "<4 items>", "std::array<int, 4u>") + % Check("a", "<4 items>", "std::array<QString, 4u>"); QTest::newRow("StdComplex") << Data("std::complex<double> c(1, 2);\n") - % Check("c (1.000000, 2.000000) std::complex<double>"); + % Check("c", "(1.000000, 2.000000)", "std::complex<double>"); QTest::newRow("StdDequeInt") << Data("std::deque<int> deque;\n" "deque.push_back(1);\n" "deque.push_back(2);\n") - % Check("deque <2 items> std::deque<int>") - % Check("deque.0 1 int") - % Check("deque.1 2 int"); + % Check("deque", "<2 items>", "std::deque<int>") + % Check("deque.0", "1", "int") + % Check("deque.1", "2", "int"); QTest::newRow("StdDequeIntStar") << Data("std::deque<int *> deque;\n" @@ -1366,168 +1453,184 @@ void tst_Dumpers::dumper_data() "deque.push_back(new int(2));\n" "deque.pop_back();\n" "deque.pop_front();\n") - % Check("deque <3 items> std::deque<int*>") - % CheckType("deque.0 int") - % Check("deque.1 0x0 int *"); + % Check("deque", "<3 items>", "std::deque<int*>") + % Check("deque.0", "", "int") + % Check("deque.1", "0x0", "int *"); QTest::newRow("StdDequeFoo") - << Data("std::deque<Foo> deque;\n" + << Data("#include <deque>\n" + fooData, + "std::deque<Foo> deque;\n" "deque.push_back(1);\n" "deque.push_front(2);\n") - % Check("deque <2 items> std::deque<Foo>") - % CheckType("deque.0 Foo") - % Check("deque.0.a 2 int") - % CheckType("deque.1 Foo") - % Check("deque.1.a 1 int"); + % Check("deque", "<2 items>", "std::deque<Foo>") + % Check("deque.0", "", "Foo") + % Check("deque.0.a", "2", "int") + % Check("deque.1", "", "Foo") + % Check("deque.1.a", "1", "int"); QTest::newRow("StdDequeFooStar") - << Data("std::deque<Foo *> deque;\n" + << Data("#include <deque>\n" + fooData, + "std::deque<Foo *> deque;\n" "deque.push_back(new Foo(1));\n" "deque.push_back(new Foo(2));\n") - % Check("deque <2 items> std::deque<Foo*>") - % CheckType("deque.0 Foo") - % Check("deque.0.a 1 int") - % CheckType("deque.1 Foo") - % Check("deque.1.a 2 int"); + % Check("deque", "<2 items>", "std::deque<Foo*>") + % Check("deque.0", "", "Foo") + % Check("deque.0.a", "1", "int") + % Check("deque.1", "", "Foo") + % Check("deque.1.a", "2", "int"); QTest::newRow("StdHashSet") - << Data("using namespace __gnu_cxx;\n" + << Data("#include <hash_set>\n" + "using namespace __gnu_cxx;\n" "hash_set<int> h;\n" "h.insert(1);\n" "h.insert(194);\n" "h.insert(2);\n" "h.insert(3);\n") - % Check("h <4 items> __gnu__cxx::hash_set<int>") - % Check("h.0 194 int") - % Check("h.1 1 int") - % Check("h.2 2 int") - % Check("h.3 3 int"); + % Check("h", "<4 items>", "__gnu__cxx::hash_set<int>") + % Check("h.0", "194", "int") + % Check("h.1", "1", "int") + % Check("h.2", "2", "int") + % Check("h.3", "3", "int"); QTest::newRow("StdListInt") - << Data("std::list<int> list;\n" + << Data("#include <list>\n" + "std::list<int> list;\n" "list.push_back(1);\n" "list.push_back(2);\n") - % Check("list <2 items> std::list<int>") - % Check("list.0 1 int") - % Check("list.1 2 int"); + % Check("list", "<2 items>", "std::list<int>") + % Check("list.0", "1", "int") + % Check("list.1", "2", "int"); QTest::newRow("StdListIntStar") - << Data("std::list<int *> list;\n" + << Data("#include <list>\n" + "std::list<int *> list;\n" "list.push_back(new int(1));\n" "list.push_back(0);\n" "list.push_back(new int(2));\n") - % Check("list <3 items> std::list<int*>") - % CheckType("list.0 int") - % Check("list.1 0x0 int *") - % CheckType("list.2 int"); + % Check("list", "<3 items>", "std::list<int*>") + % Check("list.0", "", "int") + % Check("list.1", "0x0", "int *") + % Check("list.2", "", "int"); QTest::newRow("StdListIntBig") - << Data("std::list<int> list;\n" + << Data("#include <list>\n" + "std::list<int> list;\n" "for (int i = 0; i < 10000; ++i)\n" " list.push_back(i);\n") - % Check("list <more than 1000 items> std::list<int>") - % Check("list.0 0 int") - % Check("list.999 999 int"); + % Check("list", "<more than 1000 items>", "std::list<int>") + % Check("list.0", "0", "int") + % Check("list.999", "999", "int"); QTest::newRow("StdListFoo") - << Data("std::list<Foo> list;\n" + << Data("#include <list>\n" + "std::list<Foo> list;\n" "list.push_back(15);\n" "list.push_back(16);\n") - % Check("list <2 items> std::list<Foo>") - % CheckType("list.0 Foo") - % Check("list.0.a 15 int") - % CheckType("list.1 Foo") - % Check("list.1.a 16 int"); + % Check("list", "<2 items>", "std::list<Foo>") + % Check("list.0", "", "Foo") + % Check("list.0.a", "15", "int") + % Check("list.1", "", "Foo") + % Check("list.1.a", "16", "int"); QTest::newRow("StdListFooStar") - << Data("std::list<Foo *> list;\n" + << Data("#include <list>\n" + "std::list<Foo *> list;\n" "list.push_back(new Foo(1));\n" "list.push_back(0);\n" "list.push_back(new Foo(2));\n") - % Check("list <3 items> std::list<Foo*>") - % CheckType("list.0 Foo") - % Check("list.0.a 1 int") - % Check("list.1 0x0 Foo *") - % CheckType("list.2 Foo") - % Check("list.2.a 2 int"); + % Check("list", "<3 items>", "std::list<Foo*>") + % Check("list.0", "", "Foo") + % Check("list.0.a", "1", "int") + % Check("list.1", "0x0", "Foo *") + % Check("list.2", "", "Foo") + % Check("list.2.a", "2", "int"); QTest::newRow("StdListBool") - << Data("std::list<bool> list;\n" + << Data("#include <list>\n" + "std::list<bool> list;\n" "list.push_back(true);\n" "list.push_back(false);\n") - % Check("list <2 items> std::list<bool>") - % Check("list.0 true bool") - % Check("list.1 false bool"); + % Check("list", "<2 items>", "std::list<bool>") + % Check("list.0", "true", "bool") + % Check("list.1", "false", "bool"); QTest::newRow("StdMapStringFoo") - << Data("std::map<QString, Foo> map;\n" + << Data("#include <map>\n", + "std::map<QString, Foo> map;\n" "map[\"22.0\"] = Foo(22);\n" "map[\"33.0\"] = Foo(33);\n" "map[\"44.0\"] = Foo(44);\n") - % Check("map <3 items> std::map<QString, Foo>") - % Check("map.0 std::pair<QString const, Foo>") - % Check("map.0.first \"22.0\" QString") - % CheckType("map.0.second Foo") - % Check("map.0.second.a 22 int") - % Check("map.1 std::pair<QString const, Foo>") - % Check("map.2.first \"44.0\" QString") - % CheckType("map.2.second Foo") - % Check("map.2.second.a 44 int"); + % Check("map", "<3 items>", "std::map<@QString, Foo>") + % Check("map.0", "", "std::pair<@QString const, Foo>") + % Check("map.0.first", "\"22.0\"", "@QString") + % Check("map.0.second", "", "Foo") + % Check("map.0.second.a", "22", "int") + % Check("map.1", "", "std::pair<@QString const, Foo>") + % Check("map.2.first", "\"44.0\"", "@QString") + % Check("map.2.second", "", "Foo") + % Check("map.2.second.a", "44", "int"); QTest::newRow("StdMapCharStarFoo") - << Data("std::map<const char *, Foo> map;\n" + << Data("#include <map>\n", + "std::map<const char *, Foo> map;\n" "map[\"22.0\"] = Foo(22);\n" "map[\"33.0\"] = Foo(33);\n") - % Check("map <2 items> std::map<char const*, Foo>") - % Check("map.0 std::pair<char const* const, Foo>") - % CheckType("map.0.first char *") - % Check("map.0.first.*first 50 '2' char") - % CheckType("map.0.second Foo") - % Check("map.0.second.a 22 int") - % Check("map.1 std::pair<char const* const, Foo>") - % CheckType("map.1.first char *") - % Check("map.1.first.*first 51 '3' char") - % CheckType("map.1.second Foo") - % Check("map.1.second.a 33 int"); + % Check("map", "<2 items>", "std::map<char const*, Foo>") + % Check("map.0", "", "std::pair<char const* const, Foo>") + % CheckType("map.0.first", "char *") + % Check("map.0.first.*first", "50 '2'", "char") + % Check("map.0.second", "", "Foo") + % Check("map.0.second.a", "22", "int") + % Check("map.1", "", "std::pair<char const* const, Foo>") + % CheckType("map.1.first", "char *") + % Check("map.1.first.*first", "51 '3'", "char") + % Check("map.1.second", "", "Foo") + % Check("map.1.second.a", "33", "int"); QTest::newRow("StdMapUIntUInt") - << Data("std::map<uint, uint> map;\n" + << Data("#include <map>\n", + "std::map<uint, uint> map;\n" "map[11] = 1;\n" "map[22] = 2;\n") - % Check("map <2 items> std::map<unsigned int, unsigned int>") - % Check("map.11 1 unsigned int") - % Check("map.22 2 unsigned int"); + % Check("map", "<2 items>", "std::map<unsigned int, unsigned int>") + % Check("map.11", "1", "unsigned int") + % Check("map.22", "2", "unsigned int"); QTest::newRow("StdMapUIntStringList") - << Data("std::map<uint, QStringList> map;\n" + << Data("#include <map>\n", + "std::map<uint, QStringList> map;\n" "map[11] = QStringList() << \"11\";\n" "map[22] = QStringList() << \"22\";\n") - % Check("map <2 items> std::map<unsigned int, QStringList>") - % Check("map.0 std::pair<unsigned int const, QStringList>") - % Check("map.0.first 11 unsigned int") - % Check("map.0.second <1 items> QStringList") - % Check("map.0.second.0 \"11\" QString") - % Check("map.1 std::pair<unsigned int const, QStringList>") - % Check("map.1.first 22 unsigned int") - % Check("map.1.second <1 items> QStringList") - % Check("map.1.second.0 \"22\" QString"); + % Check("map", "<2 items>", "std::map<unsigned int, @QStringList>") + % Check("map.0", "", "std::pair<unsigned int const, @QStringList>") + % Check("map.0.first", "11", "unsigned int") + % Check("map.0.second", "<1 items>", "@QStringList") + % Check("map.0.second.0", "\"11\"", "@QString") + % Check("map.1", "", "std::pair<unsigned int const, @QStringList>") + % Check("map.1.first", "22", "unsigned int") + % Check("map.1.second", "<1 items>", "@QStringList") + % Check("map.1.second.0", "\"22\"", "@QString"); QTest::newRow("StdMapUIntStringListTypedef") - << Data("typedef std::map<uint, QStringList> T;\n" + << Data("#include <map>\n", + "typedef std::map<uint, QStringList> T;\n" "T map;\n" "map[11] = QStringList() << \"11\";\n" "map[22] = QStringList() << \"22\";\n"); QTest::newRow("StdMapUIntFloat") - << Data("std::map<uint, float> map;\n" + << Data("#include <map>\n", + "std::map<uint, float> map;\n" "map[11] = 11.0;\n" "map[22] = 22.0;\n") - % Check("map <2 items> std::map<unsigned int, float>") - % Check("map.11 11 float") - % Check("map.22 22 float"); + % Check("map", "<2 items>", "std::map<unsigned int, float>") + % Check("map.11", "[11]", "11", "float") + % Check("map.22", "[22]", "22", "float"); QTest::newRow("StdMapUIntFloatIterator") - << Data("typedef std::map<int, float> Map;\n" + << Data("#include <map>\n", + "typedef std::map<int, float> Map;\n" "Map map;\n" "map[11] = 11.0;\n" "map[22] = 22.0;\n" @@ -1541,71 +1644,76 @@ void tst_Dumpers::dumper_data() "Map::iterator it4 = it3; ++it4;\n" "Map::iterator it5 = it4; ++it5;\n" "Map::iterator it6 = it5; ++it6;\n") - % Check("map <6 items> stdmap::Map") - % Check("map.11 11 float") - % Check("it1.first 11 int") - % Check("it1.second 11 float") - % Check("it6.first 66 int") - % Check("it6.second 66 float"); + % Check("map", "<6 items>", "Map") + % Check("map.11", "[11]", "11", "float") + % Check("it1.first", "11", "int") + % Check("it1.second", "11", "float") + % Check("it6.first", "66", "int") + % Check("it6.second", "66", "float"); QTest::newRow("StdMapStringFloat") - << Data("std::map<QString, float> map;\n" + << Data("#include <map>\n", + "std::map<QString, float> map;\n" "map[\"11.0\"] = 11.0;\n" "map[\"22.0\"] = 22.0;\n") - % Check("map <2 items> std::map<QString, float>") - % Check("map.0 std::pair<QString const, float>") - % Check("map.0.first \"11.0\" QString") - % Check("map.0.second 11 float") - % Check("map.1 std::pair<QString const, float>") - % Check("map.1.first \"22.0\" QString") - % Check("map.1.second 22 float"); + % Check("map", "<2 items>", "std::map<@QString, float>") + % Check("map.0", "[0]", "", "std::pair<@QString const, float>") + % Check("map.0.first", "\"11.0\"", "@QString") + % Check("map.0.second", "11", "float") + % Check("map.1", "[1]", "", "std::pair<@QString const, float>") + % Check("map.1.first", "\"22.0\"", "@QString") + % Check("map.1.second", "22", "float"); QTest::newRow("StdMapIntString") - << Data("std::map<int, QString> map;\n" + << Data("#include <map>\n", + "std::map<int, QString> map;\n" "map[11] = \"11.0\";\n" "map[22] = \"22.0\";\n") - % Check("map <2 items> std::map<int, QString>") - % Check("map.0 std::pair<int const, QString>") - % Check("map.0.first 11 int") - % Check("map.0.second \"11.0\" QString") - % Check("map.1 std::pair<int const, QString>") - % Check("map.1.first 22 int") - % Check("map.1.second \"22.0\" QString"); - - QTest::newRow("StdMapStringPointer") - << Data("QObject ob;\n" + % Check("map", "<2 items>", "std::map<int, @QString>") + % Check("map.0", "[0]", "", "std::pair<int const, @QString>") + % Check("map.0.first", "11", "int") + % Check("map.0.second", "\"11.0\"", "@QString") + % Check("map.1", "[1]", "", "std::pair<int const, @QString>") + % Check("map.1.first", "22", "int") + % Check("map.1.second", "\"22.0\"", "@QString"); + + QTest::newRow("StdMapStringPointer") + << Data("#include <map>\n", + "QObject ob;\n" "std::map<QString, QPointer<QObject> > map;\n" "map[\"Hallo\"] = QPointer<QObject>(&ob);\n" "map[\"Welt\"] = QPointer<QObject>(&ob);\n" "map[\".\"] = QPointer<QObject>(&ob);\n") - % Check("map <3 items> std::map<QString, QPointer<QObject>>") - % Check("map.0 std::pair<QString const, QPointer<QObject>>") - % Check("map.0.first \".\" QString") - % CheckType("map.0.second QPointer<QObject>") - % Check("map.2 std::pair<QString const, QPointer<QObject>>") - % Check("map.2.first \"Welt\" QString"); + % Check("map", "<3 items>", "std::map<@QString, @QPointer<@QObject>>") + % Check("map.0", "[0]", "", "std::pair<@QString const, @QPointer<@QObject>>") + % Check("map.0.first", "", "@QString") + % Check("map.0.second", "", "@QPointer<@QObject>") + % Check("map.2", "[2]", "", "std::pair<@QString const, @QPointer<@QObject>>") + % Check("map.2.first", "\"Welt\"", "@QString"); QTest::newRow("StdUniquePtr") << Data("std::unique_ptr<int> pi(new int(32));\n" "std::unique_ptr<Foo> pf(new Foo);\n") - % Check("pi 32 std::unique_ptr<int, std::default_delete<int> >") - % Check("pf 32 std::unique_ptr<Foo, std::default_delete<Foo> >"); + % Check("pi", "32", "std::unique_ptr<int, std::default_delete<int> >") + % Check("pf", "32", "std::unique_ptr<Foo, std::default_delete<Foo> >"); QTest::newRow("StdSharedPtr") << Data("std::shared_ptr<int> pi(new int(32));\n" "std::shared_ptr<Foo> pf(new Foo);\n") - % Check("pi 32 std::shared_ptr<int, std::default_delete<int> >") - % Check("pf 32 std::shared_ptr<Foo, std::default_delete<int> >"); + % Check("pi", "32", "std::shared_ptr<int, std::default_delete<int> >") + % Check("pf", "32", "std::shared_ptr<Foo, std::default_delete<int> >"); QTest::newRow("StdSetInt") - << Data("std::set<int> set;\n" + << Data("#include <set>\n", + "std::set<int> set;\n" "set.insert(11);\n" "set.insert(22);\n" "set.insert(33);\n") - % Check("set <3 items> std::set<int>"); + % Check("set", "<3 items>", "std::set<int>"); QTest::newRow("StdSetIntIterator") - << Data("typedef std::set<int> Set;\n" + << Data("#include <set>\n", + "typedef std::set<int> Set;\n" "Set set;\n" "set.insert(11.0);\n" "set.insert(22.0);\n" @@ -1619,69 +1727,76 @@ void tst_Dumpers::dumper_data() "Set::iterator it4 = it3; ++it4;\n" "Set::iterator it5 = it4; ++it5;\n" "Set::iterator it6 = it5; ++it6;\n") - % Check("set <6 items> stdset::Set") - % Check("it1.value 11 int") - % Check("it6.value 66 int"); + % Check("set", "<6 items>", "Set") + % Check("it1.value", "11", "int") + % Check("it6.value", "66", "int"); QTest::newRow("StdSetString") - << Data("std::set<QString> set;\n" + << Data("#include <set>\n", + "std::set<QString> set;\n" "set.insert(\"22.0\");\n") - % Check("set <1 items> std::set<QString>") - % Check("set.0 \"22.0\" QString"); + % Check("set", "<1 items>", "std::set<Q@String>") + % Check("set.0", "[0]", "\"22.0\"", "@QString"); QTest::newRow("StdSetPointer") - << Data("QObject ob;\n" + << Data("#include <set>\n", + "QObject ob;\n" "std::set<QPointer<QObject> > hash;\n" "QPointer<QObject> ptr(&ob);\n") - % Check("hash <0 items> std::set<QPointer<QObject>, std::less<QPointer<QObject>>, std::allocator<QPointer<QObject>>>") - % Check("ob \"\" QObject") - % CheckType("ptr QPointer<QObject>"); + % Check("hash", "<0 items>", "std::set<@QPointer<@QObject>, std::less<@QPointer<@QObject>>, std::allocator<@QPointer<@QObject>>>") + % Check("ob", "\"\"", "@QObject") + % Check("ptr", "", "@QPointer<@QObject>"); QTest::newRow("StdStack1") - << Data("std::stack<int *> s0, s;\n" + << Data("#include <stack>\n", + "std::stack<int *> s0, s;\n" "s.push(new int(1));\n" "s.push(0);\n" "s.push(new int(2));\n") - % Check("s0 <0 items> std::stack<int*>") - % Check("s <3 items> std::stack<int*>") - % CheckType("s.0 int") - % Check("s.1 0x0 int *") - % CheckType("s.2 int"); + % Check("s0", "<0 items>", "std::stack<int*>") + % Check("s", "<3 items>", "std::stack<int*>") + % Check("s.0", "[0]", "", "int") + % Check("s.1", "[1]", "0x0", "int *") + % Check("s.2", "[2]", "", "int"); QTest::newRow("StdStack2") - << Data("std::stack<int> s0, s;\n" + << Data("#include <stack>\n", + "std::stack<int> s0, s;\n" "s.push(1);\n" "s.push(2);\n") - % Check("s0 <0 items> std::stack<int>") - % Check("s <2 items> std::stack<int>") - % Check("s.0 1 int") - % Check("s.1 2 int"); + % Check("s0", "<0 items>", "std::stack<int>") + % Check("s", "<2 items>", "std::stack<int>") + % Check("s.0", "1", "int") + % Check("s.1", "2", "int"); QTest::newRow("StdStack3") - << Data("std::stack<Foo *> s, s0;\n" + << Data("#include <stack>\n", + "std::stack<Foo *> s, s0;\n" "s.push(new Foo(1));\n" "s.push(new Foo(2));\n") - % Check("s <0 items> std::stack<Foo*>") - % Check("s <1 items> std::stack<Foo*>") - % Check("s <2 items> std::stack<Foo*>") - % CheckType("s.0 Foo") - % Check("s.0.a 1 int") - % CheckType("s.1 Foo") - % Check("s.1.a 2 int"); + % Check("s", "<0 items>", "std::stack<Foo*>") + % Check("s", "<1 items>", "std::stack<Foo*>") + % Check("s", "<2 items>", "std::stack<Foo*>") + % Check("s.0", "", "Foo") + % Check("s.0.a", "1", "int") + % Check("s.1", "", "Foo") + % Check("s.1.a", "2", "int"); QTest::newRow("StdStack4") - << Data("std::stack<Foo> s0, s;\n" + << Data("#include <stack>\n", + "std::stack<Foo> s0, s;\n" "s.push(1);\n" "s.push(2);\n") - % Check("s0 <0 items> std::stack<Foo>") - % Check("s <2 items> std::stack<Foo>") - % CheckType("s.0 Foo") - % Check("s.0.a 1 int") - % CheckType("s.1 Foo") - % Check("s.1.a 2 int"); + % Check("s0", "<0 items>", "std::stack<Foo>") + % Check("s", "<2 items>", "std::stack<Foo>") + % Check("s.0", "[0]", "", "Foo") + % Check("s.0.a", "1", "int") + % Check("s.1", "[1]", "", "Foo") + % Check("s.1.a", "2", "int"); QTest::newRow("StdString1") - << Data("std::string str0, str;\n" + << Data("#include <string>\n", + "std::string str0, str;\n" "std::wstring wstr0, wstr;\n" "str += \"b\";\n" "wstr += wchar_t('e');\n" @@ -1694,111 +1809,120 @@ void tst_Dumpers::dumper_data() "wstr += wchar_t('e');\n" "wstr += wchar_t('e');\n" "str += \"e\";\n") - % Check("str0 \"\" std::string") - % Check("wstr0 \"\" std::wstring") - % Check("str \"bdebdee\" std::string") - % Check("wstr \"eeee\" std::wstring"); + % Check("str0", "\"\"", "std::string") + % Check("wstr0", "\"\"", "std::wstring") + % Check("str", "\"bdebdee\"", "std::string") + % Check("wstr", "\"eeee\"", "std::wstring"); QTest::newRow("StdString2") - << Data("std::string str = \"foo\";\n" + << Data("#include <string>\n", + "std::string str = \"foo\";\n" "std::vector<std::string> v;\n" "QList<std::string> l0, l;\n" "v.push_back(str);\n" "v.push_back(str);\n" "l.push_back(str);\n" "l.push_back(str);\n") - % Check("l0 <0 items> QList<std::string>") - % Check("l <2 items> QList<std::string>") - % Check("str \"foo\" std::string") - % Check("v <2 items> std::vector<std::string>") - % Check("v.0 \"foo\" std::string"); + % Check("l0", "<0 items>", "@QList<std::string>") + % Check("l", "<2 items>", "@QList<std::string>") + % Check("str", "\"foo\"", "std::string") + % Check("v", "<2 items>", "std::vector<std::string>") + % Check("v.0", "[0]", "\"foo\"", "std::string"); QTest::newRow("StdVector1") - << Data("std::vector<int *> v0, v;\n" + << Data("#include <vector>\n", + "std::vector<int *> v0, v;\n" "v.push_back(new int(1));\n" "v.push_back(0);\n" "v.push_back(new int(2));\n") - % Check("v0 <0 items> std::vector<int*>") - % Check("v <3 items> std::vector<int*>") - % Check("v.0 1 int") - % Check("v.1 0x0 int *") - % Check("v.2 2 int"); + % Check("v0", "<0 items>", "std::vector<int*>") + % Check("v", "<3 items>", "std::vector<int*>") + % Check("v.0", "[1]", "1", "int") + % Check("v.1", "0x0", "int *") + % Check("v.2", "[2]", "2", "int"); QTest::newRow("StdVector2") - << Data("std::vector<int> v;\n" + << Data("#include <vector>\n", + "std::vector<int> v;\n" "v.push_back(1);\n" "v.push_back(2);\n" "v.push_back(3);\n" "v.push_back(4);\n") - % Check("v <4 items> std::vector<int>") - % Check("v.0 1 int") - % Check("v.3 4 int"); + % Check("v", "<4 items>", "std::vector<int>") + % Check("v.0", "[0]", "1", "int") + % Check("v.3", "[3]", "4", "int"); QTest::newRow("StdVector3") - << Data("std::vector<Foo *> v;\n" + << Data("#include <vector>\n", + "std::vector<Foo *> v;\n" "v.push_back(new Foo(1));\n" "v.push_back(0);\n" "v.push_back(new Foo(2));\n") - % Check("v <3 items> std::vector<Foo*>") - % CheckType("v.0 Foo") - % Check("v.0.a 1 int") - % Check("v.1 0x0 Foo *") - % CheckType("v.2 Foo") - % Check("v.2.a 2 int"); + % Check("v", "<3 items>", "std::vector<Foo*>") + % Check("v.0", "[0]", "", "Foo") + % Check("v.0.a", "1", "int") + % Check("v.1", "[1]", "0x0", "Foo *") + % Check("v.2", "[2]", "", "Foo") + % Check("v.2.a", "2", "int"); QTest::newRow("StdVector4") - << Data("std::vector<Foo> v;\n" + << Data("#include <vector>\n", + "std::vector<Foo> v;\n" "v.push_back(1);\n" "v.push_back(2);\n" "v.push_back(3);\n" "v.push_back(4);\n") - % Check("v <4 items> std::vector<Foo>") - % CheckType("v.0 Foo") - % Check("v.1.a 2 int") - % CheckType("v.3 Foo"); + % Check("v", "<4 items>", "std::vector<Foo>") + % Check("v.0", "[0]", "", "Foo") + % Check("v.1.a", "2", "int") + % Check("v.3", "[3]", "", "Foo"); QTest::newRow("StdVectorBool1") - << Data("std::vector<bool> v;\n" + << Data("#include <vector>\n", + "std::vector<bool> v;\n" "v.push_back(true);\n" "v.push_back(false);\n" "v.push_back(false);\n" "v.push_back(true);\n" "v.push_back(false);\n") - % Check("v <5 items> std::vector<bool>") - % Check("v.0 true bool") - % Check("v.1 false bool") - % Check("v.2 false bool") - % Check("v.3 true bool") - % Check("v.4 false bool"); + % Check("v", "<5 items>", "std::vector<bool>") + % Check("v.0", "[0]", "true", "bool") + % Check("v.1", "[1]", "false", "bool") + % Check("v.2", "[2]", "false", "bool") + % Check("v.3", "[3]", "true", "bool") + % Check("v.4", "[4]", "false", "bool"); QTest::newRow("StdVectorBool2") - << Data("std::vector<bool> v1(65, true);\n" + << Data("#include <vector>\n", + "std::vector<bool> v1(65, true);\n" "std::vector<bool> v2(65);\n") - % Check("v1 <65 items> std::vector<bool>") - % Check("v1.0 true bool") - % Check("v1.64 true bool") - % Check("v2 <65 items> std::vector<bool>") - % Check("v2.0 false bool") - % Check("v2.64 false bool"); + % Check("v1", "<65 items>", "std::vector<bool>") + % Check("v1.0", "[0]", "true", "bool") + % Check("v1.64", "[64]", "true", "bool") + % Check("v2", "<65 items>", "std::vector<bool>") + % Check("v2.0", "[0]", "false", "bool") + % Check("v2.64", "[64]", "false", "bool"); QTest::newRow("StdVector6") - << Data("std::vector<std::list<int> *> vector;\n" + << Data("#include <vector>\n", + "std::vector<std::list<int> *> vector;\n" "std::list<int> list;\n" "vector.push_back(new std::list<int>(list));\n" "vector.push_back(0);\n" "list.push_back(45);\n" "vector.push_back(new std::list<int>(list));\n" "vector.push_back(0);\n") - % Check("list <1 items> std::list<int>") - % Check("list.0 45 int") - % Check("vector <4 items> std::vector<std::list<int>*>") - % Check("vector.0 <0 items> std::list<int>") - % Check("vector.2 <1 items> std::list<int>") - % Check("vector.2.0 45 int") - % Check("vector.3 0x0 std::list<int> *"); + % Check("list", "<1 items>", "std::list<int>") + % Check("list.0", "[0]", "45", "int") + % Check("vector", "<4 items>", "std::vector<std::list<int>*>") + % Check("vector.0", "[0]", "<0 items>", "std::list<int>") + % Check("vector.2", "[2]", "<1 items>", "std::list<int>") + % Check("vector.2.0", "45", "int") + % Check("vector.3", "[3]", "0x0", "std::list<int> *"); QTest::newRow("StdStream") - << Data("using namespace std;\n" + << Data("#include <vector>\n", + "using namespace std;\n" "ifstream is0, is;\n" "#ifdef Q_OS_WIN\n" " is.open(\"C:\\\\Program Files\\\\Windows NT\\\\Accessories\\\\wordpad.exe\");\n" @@ -1806,11 +1930,12 @@ void tst_Dumpers::dumper_data() " is.open(\"/etc/passwd\");\n" "#endif\n" " bool ok = is.good();\n") - % CheckType("is std::ifstream") - % Check("ok true bool"); + % Check("is", "", "std::ifstream") + % Check("ok", "true", "bool"); QTest::newRow("ItemModel") - << Data("QStandardItemModel m;\n" + << Data("#include <QStandardItemModel>\n", + "QStandardItemModel m;\n" "QStandardItem *i1, *i2, *i11;\n" "m.appendRow(QList<QStandardItem *>()\n" " << (i1 = new QStandardItem(\"1\")) << (new QStandardItem(\"a\")) << (new QStandardItem(\"a2\")));\n" @@ -1819,63 +1944,69 @@ void tst_Dumpers::dumper_data() " << (i2 = new QStandardItem(\"2\")) << (new QStandardItem(\"b\")));\n" "i1->appendRow(QList<QStandardItem *>()\n" " << (i11 = new QStandardItem(\"11\")) << (new QStandardItem(\"aa\")));\n") - % CheckType("i1 QStandardItem") - % CheckType("i11 QStandardItem") - % CheckType("i2 QStandardItem") - % Check("m QStandardItemModel") - % Check("mi \"1\" QModelIndex"); + % Check("i1", "", "@QStandardItem") + % Check("i11", "", "@QStandardItem") + % Check("i2", "", "@QStandardItem") + % Check("m", "", "@QStandardItemModel") + % Check("mi", "\"1\"", "@QModelIndex"); QTest::newRow("QStackInt") - << Data("QStack<int> s;\n" + << Data("#include <QStack>", + "QStack<int> s;\n" "s.append(1);\n" "s.append(2);\n") - % Check("s <2 items> QStack<int>") - % Check("s.0 1 int") - % Check("s.1 2 int"); + % Check("s", "<2 items>", "@QStack<int>") + % Check("s.0", "[0]", "1", "int") + % Check("s.1", "[1]", "2", "int"); QTest::newRow("QStackBig") - << Data("QStack<int> s;\n" + << Data("#include <QStack>", + "QStack<int> s;\n" "for (int i = 0; i != 10000; ++i)\n" " s.append(i);\n") - % Check("s <10000 items> QStack<int>") - % Check("s.0 0 int") - % Check("s.1999 1999 int"); + % Check("s", "<10000 items>", "@QStack<int>") + % Check("s.0", "[0]", "0", "int") + % Check("s.1999", "[1999]", "1999", "int"); QTest::newRow("QStackFooPointer") - << Data("QStack<Foo *> s;\n" + << Data("#include <QStack>", + "QStack<Foo *> s;\n" "s.append(new Foo(1));\n" "s.append(0);\n" "s.append(new Foo(2));\n") - % Check("s <3 items> QStack<Foo*>") - % CheckType("s.0 Foo") - % Check("s.0.a 1 int") - % Check("s.1 0x0 Foo *") - % CheckType("s.2 Foo") - % Check("s.2.a 2 int"); + % Check("s", "<3 items>", "@QStack<Foo*>") + % Check("s.0", "[0]", "", "Foo") + % Check("s.0.a", "1", "int") + % Check("s.1", "[1]", "0x0", "Foo *") + % Check("s.2", "[2]", "", "Foo") + % Check("s.2.a", "2", "int"); QTest::newRow("QStackFoo") - << Data("QStack<Foo> s;\n" + << Data("#include <QStack>" + fooData, + "QStack<Foo> s;\n" "s.append(1);\n" "s.append(2);\n" "s.append(3);\n" "s.append(4);\n") - % Check("s <4 items> QStack<Foo>") - % CheckType("s.0 Foo") - % Check("s.0.a 1 int") - % CheckType("s.3 Foo") - % Check("s.3.a 4 int"); + % Check("s", "<4 items>", "@QStack<Foo>") + % Check("s.0", "[0]", "", "Foo") + % Check("s.0.a", "1", "int") + % Check("s.3", "[3]", "", "Foo") + % Check("s.3.a", "4", "int"); QTest::newRow("QStackBool") - << Data("QStack<bool> s;\n" + << Data("#include <QStack>", + "QStack<bool> s;\n" "s.append(true);\n" "s.append(false);\n") - % Check("s <2 items> QStack<bool>") - % Check("s.0 true bool") - % Check("s.1 false bool"); + % Check("s", "<2 items>", "@QStack<bool>") + % Check("s.0", "true", "bool") + % Check("s.1", "false", "bool"); QTest::newRow("QUrl") - << Data("QUrl url(QString(\"http://qt-project.org\"));\n") - % Check("url \"http://qt-project.org\" QUrl"); + << Data("#include <QUrl>", + "QUrl url(QString(\"http://qt-project.org\"));\n") + % Check("url", "\"http://qt-project.org\"", "@QUrl"); QTest::newRow("QStringQuotes") << Data("QString str1(\"Hello Qt\");\n" @@ -1886,78 +2017,74 @@ void tst_Dumpers::dumper_data() // --> Value: ""HelloQt"" (double quote and missing \r not expected) "QString str4(\"Hello\\tQt\");\n") // --> Value: "Hello\9Qt" (expected \t instead of \9) - % Check("str1 \"Hello Qt\" QString") - % Check("str2 \"Hello\nQt\" QString") - % Check("str3 \"Hello\rQt\" QString") - % Check("str4 \"Hello\tQt\" QString"); + % Check("str1", "\"Hello Qt\"", "@QString") + % Check("str2", "\"Hello\nQt\"", "@QString") + % Check("str3", "\"Hello\rQt\"", "@QString") + % Check("str4", "\"Hello\tQt\"", "@QString"); - QTest::newRow("QString1") - << Data("QString str = \"Hello \";\n" + QByteArray stringData = "QString str = \"Hello \";\n" "str += '\\t';\n" "str += '\\r';\n" "str += '\\n';\n" "str += QLatin1Char(0);\n" "str += QLatin1Char(1);\n" - "str += \" fat \";\n" "str += \" World\";\n" - "str.prepend(\"Prefix: \");\n") - % Check("str \"Prefix: Hello big, \\t\\r\\n\\000\\001 fat World\" QString"); + "str.prepend(\"Prefix: \");\n"; + + QTest::newRow("QString1") + << Data(stringData) + % Check("str", "\"Prefix: Hello big, \\t\\r\\n\\000\\001 World\"", "@QString"); QTest::newRow("QString2") << Data("QChar data[] = { 'H', 'e', 'l', 'l', 'o' };\n" "QString str1 = QString::fromRawData(data, 4);\n" "QString str2 = QString::fromRawData(data + 1, 4);\n") - % Check("str1 \"Hell\" QString") - % Check("str2 \"ello\" QString"); - -// void stringRefTest(const QString &refstring)\n" + % Check("str1", "\"Hell\"", "@QString") + % Check("str2", "\"ello\"", "@QString"); + + QTest::newRow("QString3") + << Data( + "QString str = \"Hello \";\n" + "str += \" big, \";\n" + "str += \" World \";\n" + "QString string(\"String Test\");\n" + "QString *pstring = new QString(\"Pointer String Test\");\n" + "stringRefTest(QString(\"Ref String Test\"));\n" + "string = \"Hi\";\n" + "string += \"Du\";\n" +//void stringRefTest(const QString &refstring)\n" // dummyStatement(&refstring);\n" -// }\n" + ) + % Check("pstring", "", "@QString") + % Check("str", "\"Hello World\"", "@QString") + % Check("string", "\"HiDu\"", "@QString"); -// QTest::newRow("QString3") -// << Data( -// "QString str = "Hello ";\n" -// "str += " big, ";\n" -// "str += " fat ";\n" -// "str += " World ";\n" - -// "QString string("String Test");\n" -// "QString *pstring = new QString("Pointer String Test");\n" -// "stringRefTest(QString("Ref String Test"));\n" -// "string = "Hi";\n" -// "string += "Du";\n" -// % CheckType("pstring QString"); -// % Check("str "Hello big, fat World " QString"); -// % Check("string "HiDu" QString"); - -// QTest::newRow("QStringRef") -// << Data( -// "QString str = "Hello";\n" -// "QStringRef ref(&str, 1, 2);\n" -// % Check("ref "el" QStringRef"); - -// QTest::newRow("QStringList") -// << Data( -// "QStringList l;\n" -// "l << "Hello ";\n" -// "l << " big, ";\n" -// "l << " fat ";\n" -// "l.takeFirst();\n" -// "l << " World ";\n" -// % Check("l <3 items> QStringList"); -// % Check("l.0 " big, " QString"); -// % Check("l.1 " fat " QString"); -// % Check("l.2 " World " QString"); + QTest::newRow("QStringRef1") + << Data("QString str = \"Hello\";\n" + "QStringRef ref(&str, 1, 2);") + % Check("ref", "\"el\"", "@QStringRef"); + + QTest::newRow("QStringList") + << Data("#include <QStringList>\n", + "QStringList l;\n" + "l << \"Hello \";\n" + "l << \" big, \";\n" + "l.takeFirst();\n" + "l << \" World \";\n") + % Check("l", "<2 items>", "@QStringList") + % Check("l.0", "\" big, \"", "@QString") + % Check("l.1", "\" World \"", "@QString"); QTest::newRow("String") - << Data("const wchar_t *w = L\"aöa\";\n" + << Data("#include <QString>", + "const wchar_t *w = L\"aöa\";\n" "QString u;\n" "if (sizeof(wchar_t) == 4)\n" " u = QString::fromUcs4((uint *)w);\n" "else\n" " u = QString::fromUtf16((ushort *)w);\n") - % Check("u \"aöa\" QString") - % CheckType("w wchar_t *"); + % Check("u", "\"aöa\"", "@QString") + % CheckType("w", "", "wchar_t *"); // All: Select UTF-8 in "Change Format for Type" in L&W context menu"); // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu"); @@ -1972,11 +2099,11 @@ void tst_Dumpers::dumper_data() "const unsigned char uu[] = { 'a', 153 /* ö Latin1 */, 'a' };\n" "const unsigned char *u = uu;\n" "const wchar_t *w = L\"aöa\";\n") - % CheckType("u unsigned char *") - % CheckType("uu unsigned char [3]") - % CheckType("s char *") - % CheckType("t char *") - % CheckType("w wchar_t *"); + % CheckType("u", "unsigned char *") + % CheckType("uu", "unsigned char [3]") + % CheckType("s", "char *") + % CheckType("t", "char *") + % CheckType("w", "wchar_t *"); // All: Select UTF-8 in "Change Format for Type" in L&W context menu"); // Windows: Select UTF-16 in "Change Format for Type" in L&W context menu"); @@ -1987,37 +2114,41 @@ void tst_Dumpers::dumper_data() << Data("const char s[] = \"aöa\";\n" "const char t[] = \"aöax\";\n" "const wchar_t w[] = L\"aöa\";\n") - % CheckType("s char [5]") - % CheckType("t char [6]") - % CheckType("w wchar_t [4]"); + % CheckType("s", "char [5]") + % CheckType("t", "char [6]") + % CheckType("w", "wchar_t [4]"); QTest::newRow("Text") - << Data("QApplication app(arrc, argv)\n" + << Data("#include <QApplication>\n" + "#include <QTextCursor>\n" + "#include <QTextDocument>\n", + "QApplication app(arrc, argv)\n" "QTextDocument doc;\n" "doc.setPlainText(\"Hallo\\nWorld\");\n" "QTextCursor tc;\n" "tc = doc.find(\"all\");\n" "int pos = tc.position();\n" "int anc = tc.anchor();\n") - % CheckType("doc QTextDocument") - % Check("tc 4 QTextCursor") - % Check("pos 4 int") - % Check("anc 1 int"); + % CheckType("doc", "QTextDocument") + % Check("tc", "4", "QTextCursor") + % Check("pos", "4", "int") + % Check("anc", "1", "int"); QTest::newRow("QThread") - << Data("const int N = 14;\n" + << Data("#include <QThread>\n", + "const int N = 14;\n" "Thread thread[N];\n" "for (int i = 0; i != N; ++i) {\n" " thread[i].setId(i);\n" " thread[i].setObjectName(\"This is thread #\" + QString::number(i));\n" " thread[i].start();\n" "}\n") - % CheckType("thread qthread::Thread [14]") - % Check("thread.0 qthread::Thread") - % Check("thread.0.@1.@1 \"This is thread #0\" qthread::Thread") - % Check("thread.13 qthread::Thread") - % Check("thread.13.@1.@1 \"This is thread #13\" qthread::Thread"); + % CheckType("thread", "Thread [14]") + % Check("thread.0", "", "Thread") + % Check("thread.0.@1.@1", "\"This is thread #0\"", "Thread") + % Check("thread.13", "", "Thread") + % Check("thread.13.@1.@1", "\"This is thread #13\"", "Thread"); QByteArray variantData = "Q_DECLARE_METATYPE(QHostAddress)\n" @@ -2027,16 +2158,17 @@ void tst_Dumpers::dumper_data() "Q_DECLARE_METATYPE(QMap<uint COMMA QStringList>)\n"; QTest::newRow("QVariant1") - << Data("QVariant value;\n" + << Data("#include <QVariant>\n", + "QVariant value;\n" "QVariant::Type t = QVariant::String;\n" "value = QVariant(t, (void*)0);\n" "*(QString*)value.data() = QString(\"Some string\");\n" "int i = 1;\n") - % Check("t QVariant::String (10) QVariant::Type") - % Check("value \"Some string\" QVariant (QString)"); + % Check("t", "QVariant::String (10)", "@QVariant::Type") + % Check("value", "\"Some string\"", "@QVariant (QString)"); QTest::newRow("QVariant2") - << Data(variantData, + << Data("#include <QVariant>\n" + variantData, "QVariant var; // Type 0, invalid\n" "QVariant var1(true); // 1, bool\n" "QVariant var2(2); // 2, int\n" @@ -2051,17 +2183,17 @@ void tst_Dumpers::dumper_data() "QVariant var19(QRect(100, 200, 300, 400)); // 19 QRect\n" "QVariant var20(QRectF(100, 200, 300, 400)); // 20 QRectF\n" ) - % Check("var (invalid) QVariant (invalid)") - % Check("var1 true QVariant (bool)") - % Check("var2 2 QVariant (int)") - % Check("var3 3 QVariant (uint)") - % Check("var4 4 QVariant (qlonglong)") - % Check("var5 5 QVariant (qulonglong)") - % Check("var6 6 QVariant (double)") - % Check("var7 '?' (7) QVariant (QChar)") - % Check("var10 \"Hello 10\" QVariant (QString)") - % Check("var19 300x400+100+200 QVariant (QRect)") - % Check("var20 300x400+100+200 QVariant (QRectF)"); + % Check("var", "(invalid)", "@QVariant (invalid)") + % Check("var1", "true", "@QVariant (bool)") + % Check("var2", "2", "@QVariant (int)") + % Check("var3", "3", "@QVariant (uint)") + % Check("var4", "4", "@QVariant (qlonglong)") + % Check("var5", "5", "@QVariant (qulonglong)") + % Check("var6", "6", "@QVariant (double)") + % Check("var7", "'?' (7)", "@QVariant (QChar)") + % Check("var10", "\"Hello 10\"", "@QVariant (QString)") + % Check("var19", "300x400+100+200", "@QVariant (QRect)") + % Check("var20", "300x400+100+200", "@QVariant (QRectF)"); /* "QStringList", # 11 @@ -2102,28 +2234,31 @@ void tst_Dumpers::dumper_data() // % Check("var <3 items> QVariant (QStringList)"); // % Check("var.0 "World" QString"); -// QTest::newRow("QVariant4") -// << Data( -// "QVariant var;\n" -// "QHostAddress ha("127.0.0.1");\n" -// "var.setValue(ha);\n" -// "QHostAddress ha1 = var.value<QHostAddress>();\n" -// % Check("ha "127.0.0.1" QHostAddress"); -// % Check("ha.a 0 quint32"); -// % CheckType("ha.a6 Q_IPV6ADDR"); -// % Check("ha.ipString "127.0.0.1" QString"); -// % Check("ha.isParsed false bool"); -// % Check("ha.protocol QAbstractSocket::UnknownNetworkLayerProtocol (-1) QAbstractSocket::NetworkLayerProtocol"); -// % Check("ha.scopeId "" QString"); -// % Check("ha1 "127.0.0.1" QHostAddress"); -// % Check("ha1.a 0 quint32"); -// % CheckType("ha1.a6 Q_IPV6ADDR"); -// % Check("ha1.ipString "127.0.0.1" QString"); -// % Check("ha1.isParsed false bool"); -// % Check("ha1.protocol QAbstractSocket::UnknownNetworkLayerProtocol (-1) QAbstractSocket::NetworkLayerProtocol"); -// % Check("ha1.scopeId "" QString"); -// % CheckType("var QVariant (QHostAddress)"); -// % Check("var.data "127.0.0.1" QHostAddress"); + QTest::newRow("QVariant4") + << Data("#include <QHostAddress>\n" + "#include <QVariant>\n", + "QVariant var;\n" + "QHostAddress ha(\"127.0.0.1\");\n" + "var.setValue(ha);\n" + "QHostAddress ha1 = var.value<QHostAddress>();\n") + % Check("ha", "\"127.0.0.1\"", "@QHostAddress") + % Check("ha.a", "0", "quint32") + % Check("ha.a6", "", "Q_IPV6ADDR") + % Check("ha.ipString", "\"127.0.0.1\"", "@QString") + % Check("ha.isParsed", "false", "bool") + % Check("ha.protocol", "QAbstractSocket::UnknownNetworkLayerProtocol (-1)", + "@QAbstractSocket::NetworkLayerProtocol") + % Check("ha.scopeId", "", "@QString") + % Check("ha1", "\"127.0.0.1\"", "@QHostAddress") + % Check("ha1.a", "0", "quint32") + % Check("ha1.a6", "", "Q_IPV6ADDR") + % Check("ha1.ipString", "\"127.0.0.1\"", "@QString") + % Check("ha1.isParsed", "false", "bool") + % Check("ha1.protocol", "QAbstractSocket::UnknownNetworkLayerProtocol (-1)", + "@QAbstractSocket::NetworkLayerProtocol") + % Check("ha1.scopeId", "", "@QString") + % CheckType("var", "", "@QVariant (QHostAddress)") + % Check("var.data", "\"127.0.0.1\"", "@QHostAddress"); // QTest::newRow("QVariant5") // << Data( @@ -2165,21 +2300,21 @@ void tst_Dumpers::dumper_data() // "list << 1 << 2 << 3;\n" // "QVariant variant = qVariantFromValue(list);\n" // % Check("list <3 items> QList<int>"); -// % Check("list.0 1 int"); -// % Check("list.1 2 int"); -// % Check("list.2 3 int"); +// % Check("list.0", "1", "int"); +// % Check("list.1", "2", "int"); +// % Check("list.2", "3", "int"); // % CheckType("variant QVariant (QList<int>)"); // % Check("variant.data <3 items> QList<int>"); -// % Check("variant.data.0 1 int"); -// % Check("variant.data.1 2 int"); -// % Check("variant.data.2 3 int"); +// % Check("variant.data.0", "1", "int"); +// % Check("variant.data.1", "2", "int"); +// % Check("variant.data.2", "3", "int"); // // Continue"); // list.clear();\n" // list = variant.value<QList<int> >();\n" // % Check("list <3 items> QList<int>");\n" -// % Check("list.0 1 int"); -// % Check("list.1 2 int"); -// % Check("list.2 3 int"); +// % Check("list.0", "1", "int"); +// % Check("list.1", "2", "int"); +// % Check("list.2", "3", "int"); // QTest::newRow("QVariantList") // << Data( @@ -2222,8 +2357,8 @@ void tst_Dumpers::dumper_data() // for (int i = 0; i != vec.size(); ++i) // vec[i] = i * i; // % Check("vec <10000 items> QVector<int>"); -// % Check("vec.0 0 int"); -// % Check("vec.1999 3996001 int"); +// % Check("vec.0", "0", "int"); +// % Check("vec.1999", "3996001", "int"); // // Continue"); // // step over @@ -2233,8 +2368,8 @@ void tst_Dumpers::dumper_data() // vec.append(1); // vec.append(1); // % Check("vec <10002 items> QVector<int>"); -// % Check("vec.1 1 int"); -// % Check("vec.2 2 int"); +// % Check("vec.1", "1", "int"); +// % Check("vec.2", "2", "int"); // QTest::newRow("QVectorFoo") // << Data( @@ -2246,10 +2381,10 @@ void tst_Dumpers::dumper_data() // "vec.append(1);\n" // "vec.append(2);\n" // % Check("vec <2 items> QVector<Foo>"); -// % CheckType("vec.0 Foo"); -// % Check("vec.0.a 1 int"); -// % CheckType("vec.1 Foo"); -// % Check("vec.1.a 2 int"); +// % Check("vec.0", "Foo"); +// % Check("vec.0.a", "1", "int"); +// % Check("vec.1", "Foo"); +// % Check("vec.1.a", "2", "int"); // typedef QVector<Foo> FooVector; @@ -2278,13 +2413,13 @@ void tst_Dumpers::dumper_data() // // switch "Auto derefencing pointers" in Locals context menu\n" // // off and on again, and check result looks sane");\n" // % Check("vec <4 items> QVector<Foo*>"); -// % CheckType("vec.0 Foo"); -// % Check("vec.0.a 1 int"); +// % Check("vec.0", "Foo"); +// % Check("vec.0.a", "1", "int"); // % Check("vec.1 0x0 Foo *"); -// % CheckType("vec.2 Foo"); -// % Check("vec.2.a 2 int"); -// % CheckType("vec.3 Fooooo"); -// % Check("vec.3.a 5 int"); +// % Check("vec.2", "Foo"); +// % Check("vec.2.a", "2", "int"); +// % Check("vec.3", "Fooooo"); +// % Check("vec.3.a", "5", "int"); // QTest::newRow("QVectorBool") // << Data( @@ -2296,30 +2431,30 @@ void tst_Dumpers::dumper_data() // vec.append(true); // vec.append(false); // % Check("vec <2 items> QVector<bool>"); -// % Check("vec.0 true bool"); -// % Check("vec.1 false bool"); +// % Check("vec.0", "true", "bool"); +// % Check("vec.1", "false", "bool"); // QTest::newRow("QVectorListInt") // << Data( // "QVector<QList<int> > vec; // "QVector<QList<int> > *pv = &vec; -// % CheckType("pv QVector<QList<int>>"); +// % Check("pv", "QVector<QList<int>>"); // % Check("vec <0 items> QVector<QList<int>>"); // // Continue"); // "vec.append(QList<int>() << 1); // "vec.append(QList<int>() << 2 << 3); -// % CheckType("pv QVector<QList<int>>"); +// % Check("pv", "QVector<QList<int>>"); // % Check("pv.0 <1 items> QList<int>"); -// % Check("pv.0.0 1 int"); +// % Check("pv.0.0", "1", "int"); // % Check("pv.1 <2 items> QList<int>"); -// % Check("pv.1.0 2 int"); -// % Check("pv.1.1 3 int"); +// % Check("pv.1.0", "2", "int"); +// % Check("pv.1.1", "3", "int"); // % Check("vec <2 items> QVector<QList<int>>"); // % Check("vec.0 <1 items> QList<int>"); -// % Check("vec.0.0 1 int"); +// % Check("vec.0.0", "1", "int"); // % Check("vec.1 <2 items> QList<int>"); -// % Check("vec.1.0 2 int"); -// % Check("vec.1.1 3 int"); +// % Check("vec.1.0", "2", "int"); +// % Check("vec.1.1", "3", "int"); //namespace noargs { @@ -2345,21 +2480,21 @@ void tst_Dumpers::dumper_data() // "list2.append(Goo("Hello", 1)); // "list2.append(Goo("World", 2)); -// % Check("i 1 int"); -// % Check("k 3 int"); +// % Check("i", "1", "int"); +// % Check("k", "3", "int"); // % Check("list <2 items> noargs::GooList"); -// % CheckType("list.0 noargs::Goo"); -// % Check("list.0.n_ 1 int"); +// % Check("list.0", "noargs::Goo"); +// % Check("list.0.n_", "1", "int"); // % Check("list.0.str_ "Hello" QString"); -// % CheckType("list.1 noargs::Goo"); -// % Check("list.1.n_ 2 int"); +// % Check("list.1", "noargs::Goo"); +// % Check("list.1.n_", "2", "int"); // % Check("list.1.str_ "World" QString"); // % Check("list2 <2 items> QList<noargs::Goo>"); -// % CheckType("list2.0 noargs::Goo"); -// % Check("list2.0.n_ 1 int"); +// % Check("list2.0", "noargs::Goo"); +// % Check("list2.0.n_", "1", "int"); // % Check("list2.0.str_ "Hello" QString"); -// % CheckType("list2.1 noargs::Goo"); -// % Check("list2.1.n_ 2 int"); +// % Check("list2.1", "noargs::Goo"); +// % Check("list2.1.n_", "2", "int"); // % Check("list2.1.str_ "World" QString"); @@ -2450,9 +2585,9 @@ void tst_Dumpers::dumper_data() // "MyAnon anon;\n" // "baz::MyBaz baz;\n" // % CheckType("anon namespc::nested::(anonymous namespace)::MyAnon"); -// % CheckType("bar namespc::nested::MyBar"); +// % Check("bar", "namespc::nested::MyBar"); // % CheckType("baz namespc::nested::(anonymous namespace)::baz::MyBaz"); -// % CheckType("foo namespc::nested::MyFoo"); +// % Check("foo", "namespc::nested::MyFoo"); // // Continue"); // // step into the doit() functions @@ -2471,14 +2606,14 @@ void tst_Dumpers::dumper_data() // "int y[2] = { 1, 2 };\n" // "int z __attribute__ ((vector_size (8))) = { 1, 2 };\n" // "#endif\n" -// % Check("v.0 1 char"); -// % Check("v.1 2 char"); -// % Check("w.0 1 char"); -// % Check("w.1 2 char"); -// % Check("y.0 1 int"); -// % Check("y.1 2 int"); -// % Check("z.0 1 int"); -// % Check("z.1 2 int"); +// % Check("v.0", "1", "char"); +// % Check("v.1", "2", "char"); +// % Check("w.0", "1", "char"); +// % Check("w.1", "2", "char"); +// % Check("y.0", "1", "int"); +// % Check("y.1", "2", "int"); +// % Check("z.0", "1", "int"); +// % Check("z.1", "2", "int"); //class Z : public QObject @@ -2511,14 +2646,14 @@ void tst_Dumpers::dumper_data() // "quint32 u32s = 0;\n" // "qint32 s32s = LONG_MIN;\n" -// % Check("u64 18446744073709551615 quint64"); -// % Check("s64 9223372036854775807 qint64"); -// % Check("u32 4294967295 quint32"); -// % Check("s32 2147483647 qint32"); -// % Check("u64s 0 quint64"); -// % Check("s64s -9223372036854775808 qint64"); -// % Check("u32s 0 quint32"); -// % Check("s32s -2147483648 qint32"); +// % Check("u64", "18446744073709551615", "quint64"); +// % Check("s64", "9223372036854775807", "qint64"); +// % Check("u32", "4294967295", "quint32"); +// % Check("s32", "2147483647", "qint32"); +// % Check("u64s", "0", "quint64"); +// % Check("s64s", "-9223372036854775808", "qint64"); +// % Check("u32s", "0", "quint32"); +// % Check("s32s", "-2147483648", "qint32"); // QTest::newRow("Array1") @@ -2529,8 +2664,8 @@ void tst_Dumpers::dumper_data() // " d[i][j] = i + j;\n" // % CheckType("d double [3][3]"); // % CheckType("d.0 double [3]"); -// % Check("d.0.0 0 double"); -// % Check("d.0.2 2 double"); +// % Check("d.0.0", "0", "double"); +// % Check("d.0.2", "2", "double"); // % CheckType("d.2 double [3]"); // QTest::newRow("Array2") @@ -2580,63 +2715,62 @@ void tst_Dumpers::dumper_data() // " << Data(\n" // "}\n" // % CheckType("foo Foo [10]"); -// % CheckType("foo.0 Foo"); -// % CheckType("foo.9 Foo"); - - -// QTest::newRow("Bitfields") -// << Data( -// "struct S\n" -// "{\n" -// " uint x : 1;\n" -// " uint y : 1;\n" -// " bool c : 1;\n" -// " bool b;\n" -// " float f;\n" -// " double d;\n" -// " qreal q;\n" -// " int i;\n" -// "};\n" -//"\n" -// "S s;\n" -// % CheckType("s basic::S"); -// % CheckType("s.b bool"); -// % CheckType("s.c bool"); -// % CheckType("s.d double"); -// % CheckType("s.f float"); -// % CheckType("s.i int"); -// % CheckType("s.q qreal"); -// % CheckType("s.x uint"); -// % CheckType("s.y uint"); - - -// QTest::newRow("Function") -// << Data( -// "struct Function\n" -// "{\n" -// " Function(QByteArray var, QByteArray f, double min, double max)\n" -// " : var(var), f(f), min(min), max(max) {}\n" -// " QByteArray var;\n" -// " QByteArray f;\n" -// " double min;\n" -// " double max;\n" -// "};\n",\n" -// "// In order to use this, switch on the 'qDump__Function' in dumper.py\n" -// "Function func0, func("x", "sin(x)", 0, 1);\n" -// "func.max = 10;\n" -// "func.f = "cos(x)";\n" -// "func.max = 4;\n" -// "func.max = 5;\n" -// "func.max = 6;\n" -// "func.max = 7;\n" -// % CheckType("func basic::Function"); -// % Check("func.f "sin(x)" QByteArray"); -// % Check("func.max 1 double"); -// % Check("func.min 0 double"); -// % Check("func.var "x" QByteArray"); -// % CheckType("func basic::Function"); -// % Check("func.f "cos(x)" QByteArray"); -// % Check("func.max 7 double"); +// % Check("foo.0", "Foo"); +// % Check("foo.9", "Foo"); + + + QTest::newRow("Bitfields") + << Data("struct S\n" + "{\n" + " uint x : 1;\n" + " uint y : 1;\n" + " bool c : 1;\n" + " bool b;\n" + " float f;\n" + " double d;\n" + " qreal q;\n" + " int i;\n" + "};\n" + "\n" + "S s;\n") + % Check("s", "", "S") + % Check("s.b", "", "bool") + % Check("s.c", "", "bool") + % Check("s.d", "", "double") + % Check("s.f", "", "float") + % Check("s.i", "", "int") + % Check("s.q", "", "qreal") + % Check("s.x", "", "uint") + % Check("s.y", "", "uint"); + + + QTest::newRow("Function") + << Data("#include <QByteArray>\n", + "struct Function\n" + "{\n" + " Function(QByteArray var, QByteArray f, double min, double max)\n" + " : var(var), f(f), min(min), max(max) {}\n" + " QByteArray var;\n" + " QByteArray f;\n" + " double min;\n" + " double max;\n" + "};\n" + "// In order to use this, switch on the 'qDump__Function' in dumper.py\n" + "Function func0, func(\"x\", \"sin(x)\", 0, 1);\n" + "func.max = 10;\n" + "func.f = \"cos(x)\";\n" + "func.max = 4;\n" + "func.max = 5;\n" + "func.max = 6;\n" + "func.max = 7;\n") + % Check("func", "", "basic::Function") + % Check("func.f", "sin(x)", "@QByteArray") + % Check("func.max", "1", "double") + % Check("func.min", "0", "double") + % Check("func.var", "\"x\"", "@QByteArray") + % Check("func", "", "basic::Function") + % Check("func.f", "\"cos(x)\"", "@QByteArray") + % Check("func.max", "7", "double"); // QTest::newRow("AlphabeticSorting") // << Data( @@ -2648,11 +2782,11 @@ void tst_Dumpers::dumper_data() // " Color() { r = 1, g = 2, b = 3, a = 4; }\n" // "};\n" // " Color c;\n" -// % CheckType("c basic::Color"); -// % Check("c.a 4 int"); -// % Check("c.b 3 int"); -// % Check("c.g 2 int"); -// % Check("c.r 1 int"); +// % Check("c", "basic::Color"); +// % Check("c.a", "4", "int"); +// % Check("c.b", "3", "int"); +// % Check("c.g", "2", "int"); +// % Check("c.r", "1", "int"); // // Manual: Toogle "Sort Member Alphabetically" in context menu // // Manual: of "Locals and Expressions" view"); @@ -2671,10 +2805,10 @@ void tst_Dumpers::dumper_data() // "myType2 t2 = 0;\n" // "ns::vl j = 1000;\n" // "ns::verylong k = 1000;\n" -// % Check("j 1000 basic::ns::vl"); -// % Check("k 1000 basic::ns::verylong"); -// % Check("t1 0 basic::myType1"); -// % Check("t2 0 basic::myType2"); +// % Check("j", "1000", "basic::ns::vl"); +// % Check("k", "1000", "basic::ns::verylong"); +// % Check("t1", "0", "basic::myType1"); +// % Check("t2", "0", "basic::myType2"); // QTest::newRow("Struct") // << Data( @@ -2682,9 +2816,9 @@ void tst_Dumpers::dumper_data() // "f.doit();\n" // "f.doit();\n" // "f.doit();\n" -// % CheckType("f Foo"); -// % Check("f.a 5 int"); -// % Check("f.b 2 int"); +// % Check("f", "Foo"); +// % Check("f.a", "5", "int"); +// % Check("f.b", "2", "int"); // QTest::newRow("Union") // << Data( @@ -2693,9 +2827,9 @@ void tst_Dumpers::dumper_data() // " int a;\n" // " int b;\n" // "} u;\n" -// % CheckType("u basic::U"); -// % CheckType("u.a int"); -// % CheckType("u.b int"); +// % Check("u", "basic::U"); +// % Check("u.a", "int"); +// % Check("u.b", "int"); // QTest::newRow("TypeFormats") // << Data( @@ -2728,23 +2862,23 @@ void tst_Dumpers::dumper_data() // }; // void A::doSomething(CVoidPtr cp) const -// % CheckType("cp basic::CVoidPtr"); +// % Check("cp", "basic::CVoidPtr"); // QTest::newRow("Pointer") // << Data( // "Foo *f = new Foo();\n" -// % CheckType("f Foo"); -// % Check("f.a 0 int"); -// % Check("f.b 5 int"); +// % Check("f", "Foo"); +// % Check("f.a", "0", "int"); +// % Check("f.b", "5", "int"); // QTest::newRow("PointerTypedef") // << Data( // "A a;\n" // "VoidPtr p = &a;\n" // "CVoidPtr cp = &a;\n" -// % CheckType("a basic::A"); -// % CheckType("cp basic::CVoidPtr"); -// % CheckType("p basic::VoidPtr"); +// % Check("a", "basic::A"); +// % Check("cp", "basic::CVoidPtr"); +// % Check("p", "basic::VoidPtr"); // QTest::newRow("StringWithNewline") // << Data( @@ -2759,10 +2893,10 @@ void tst_Dumpers::dumper_data() // "typedef int &Ref;\n" // "const int c = 44;\n" // "const Ref d = a;\n" -// % Check("a 43 int"); +// % Check("a", "43", "int"); // % Check("b 43 int &"); -// % Check("c 44 int"); -// % Check("d 43 basic::Ref"); +// % Check("c", "44", "int"); +// % Check("d", "43", "basic::Ref"); // QTest::newRow("Reference2") // << Data( @@ -2776,21 +2910,21 @@ void tst_Dumpers::dumper_data() // % Check("c "world" QString"); // % Check("d "hello" basic::Ref"); -// QTest::newRow("Reference3(const QString &a)\n" -// "const QString &b = a;\n" -// "typedef QString &Ref;\n" -// "const Ref d = const_cast<Ref>(a);\n" -// % Check("a "hello" QString &"); -// % Check("b "hello" QString &"); -// % Check("d "hello" basic::Ref"); - -// QTest::newRow("DynamicReference") -// << Data( -// "DerivedClass d;\n" -// "BaseClass *b1 = &d;\n" -// "BaseClass &b2 = d;\n" -// % CheckType("b1 DerivedClass *"); -// % CheckType("b2 DerivedClass &"); + QTest::newRow("Reference3") + << Data("#include <QString>\n", + "const QString &b = a;\n" + "typedef QString &Ref;\n" + "const Ref d = const_cast<Ref>(a);\n") + % Check("a", "\"hello\"", "@QString &") + % Check("b", "\"hello\"", "@QString &") + % Check("d", "\"hello\"", "Ref"); + + QTest::newRow("DynamicReference") + << Data("DerivedClass d;\n" + "BaseClass *b1 = &d;\n" + "BaseClass &b2 = d;\n") + % CheckType("b1", "DerivedClass *") + % CheckType("b2", "DerivedClass &"); // QTest::newRow("LongEvaluation1") // << Data( @@ -2801,11 +2935,11 @@ void tst_Dumpers::dumper_data() // " bigv[i] = time;\n" // " time = time.addDays(1);\n" // "}\n" -// % Check("N 10000 int"); +// % Check("N", "10000", "int"); // % CheckType("bigv QDateTime [10000]"); -// % CheckType("bigv.0 QDateTime"); -// % CheckType("bigv.9999 QDateTime"); -// % CheckType("time QDateTime"); +// % Check("bigv.0", "QDateTime"); +// % Check("bigv.9999", "QDateTime"); +// % Check("time", "QDateTime"); // QTest::newRow("LongEvaluation2") // << Data( @@ -2813,10 +2947,10 @@ void tst_Dumpers::dumper_data() // "int bigv[N];\n" // "for (int i = 0; i < 10000; ++i)\n" // " bigv[i] = i;\n" -// % Check("N 10000 int"); +// % Check("N", "10000", "int"); // % CheckType("bigv int [10000]"); -// % Check("bigv.0 0 int"); -// % Check("bigv.9999 9999 int"); +// % Check("bigv.0", "0", "int"); +// % Check("bigv.9999", "9999", "int"); // QTest::newRow("Fork") // << Data( @@ -2835,7 +2969,7 @@ void tst_Dumpers::dumper_data() // "typedef int (*func_t)(int);\n" // "func_t f = testFunctionPointerHelper;\n" // "int a = f(43);\n" -// % CheckType("f basic::func_t"); +// % Check("f", "basic::func_t"); // QByteArray dataClass = "struct Class // "{\n" @@ -2851,7 +2985,7 @@ void tst_Dumpers::dumper_data() // "typedef int (Class::*func_t)(int);\n" // "func_t f = &Class::testFunctionPointerHelper;\n" // "int a = (x.*f)(43);\n" -// % CheckType("f basic::func_t"); +// % Check("f", "basic::func_t"); // QTest::newRow("MemberPointer") // << Data( @@ -2859,18 +2993,18 @@ void tst_Dumpers::dumper_data() // typedef int (Class::*member_t);\n" // member_t m = &Class::a;\n" // int a = x.*m;\n" -// % CheckType("m basic::member_t");\n" +// % Check("m", "basic::member_t");\n" // // Continue");\n" // % Check("there's a valid display for m"); // QTest::newRow("PassByReferenceHelper(Foo &f) // % CheckType("f Foo &");\n" -// % Check("f.a 12 int");\n" +// % Check("f.a", "12", "int");\n" // // Continue");\n" // ++f.a;\n" // % CheckType("f Foo &");\n" -// % Check("f.a 13 int");\n" +// % Check("f.a", "13", "int");\n" // QTest::newRow("PassByReference") // << Data( @@ -2882,9 +3016,9 @@ void tst_Dumpers::dumper_data() // "qint64 a = Q_INT64_C(0xF020304050607080);\n" // "quint64 b = Q_UINT64_C(0xF020304050607080);\n" // "quint64 c = std::numeric_limits<quint64>::max() - quint64(1);\n" -// % Check("a -1143861252567568256 qint64"); -// % Check("b -1143861252567568256 quint64"); -// % Check("c -2 quint64"); +// % Check("a", "-1143861252567568256", "qint64"); +// % Check("b", "-1143861252567568256", "quint64"); +// % Check("c", "-2", "quint64"); // QTest::newRow("Hidden") // << Data( @@ -2892,47 +3026,47 @@ void tst_Dumpers::dumper_data() // int n = 1;\n" // n = 2;\n" // BREAK_HERE;\n" -// % Check("n 2 int");\n" +// % Check("n", "2", "int");\n" // // Continue");\n" // n = 3;\n" // BREAK_HERE;\n" -// % Check("n 3 int");\n" +// % Check("n", "3", "int");\n" // // Continue");\n" // {\n" // QString n = "2";\n" // BREAK_HERE;\n" // % Check("n "2" QString");\n" -// % Check("n@1 3 int");\n" +// % Check("n@1", "3", "int");\n" // // Continue");\n" // n = "3";\n" // BREAK_HERE;\n" // % Check("n "3" QString");\n" -// % Check("n@1 3 int");\n" +// % Check("n@1", "3", "int");\n" // // Continue");\n" // {\n" // double n = 3.5;\n" // BREAK_HERE;\n" -// % Check("n 3.5 double");\n" +// % Check("n", "3.5", "double");\n" // % Check("n@1 "3" QString");\n" -// % Check("n@2 3 int");\n" +// % Check("n@2", "3", "int");\n" // // Continue");\n" // ++n;\n" // BREAK_HERE;\n" -// % Check("n 4.5 double");\n" +// % Check("n", "4.5", "double");\n" // % Check("n@1 "3" QString");\n" -// % Check("n@2 3 int");\n" +// % Check("n@2", "3", "int");\n" // // Continue");\n" // dummyStatement(&n);\n" // }\n" // BREAK_HERE;\n" // % Check("n "3" QString");\n" -// % Check("n@1 3 int");\n" +// % Check("n@1", "3", "int");\n" // // Continue");\n" // n = "3";\n" // n = "4"; // BREAK_HERE;\n" // % Check("n "4" QString");\n" -// % Check("n@1 3 int");\n" +// % Check("n@1", "3", "int");\n" // // Continue");\n" // dummyStatement(&n);\n" // }\n" @@ -2963,11 +3097,11 @@ void tst_Dumpers::dumper_data() // { // bool b = testReturnBool(); // BREAK_HERE; -// % Check("b true bool"); +// % Check("b", "true", "bool"); // // Continue"); // int i = testReturnInt(); // BREAK_HERE; -// % Check("i 1 int"); +// % Check("i", "1", "int"); // // Continue"); // QString s = testReturnQString(); // BREAK_HERE; @@ -3018,8 +3152,8 @@ void tst_Dumpers::dumper_data() // __m128 sseA, sseB;\n" // sseA = _mm_loadu_ps(a);\n" // sseB = _mm_loadu_ps(b);\n" -// % CheckType("sseA __m128"); -// % CheckType("sseB __m128"); +// % Check("sseA", "__m128"); +// % Check("sseB", "__m128"); // // Continue"); // dummyStatement(&i, &sseA, &sseB); // #endif @@ -3037,7 +3171,7 @@ void tst_Dumpers::dumper_data() //" QScriptValue s;n" //"n" //" % Check("engine QScriptEngine");n" -//" % Check("s (invalid) QScriptValue");n" +//" % Check("s", "(invalid)", "QScriptValue");n" //" % Check("x1 <not accessible> QString");n" //" // Continue");n" //" s = QScriptValue(33);n" @@ -3055,30 +3189,30 @@ void tst_Dumpers::dumper_data() //" date = s.toDateTime();n" //" s.setProperty("a", QScriptValue());n" //" QScriptValue d = s.data();n" -// % Check("d (invalid) QScriptValue"); +// % Check("d", "(invalid)", "QScriptValue"); // % Check("v 43 QVariant (int)"); -// % Check("x 33 int"); +// % Check("x", "33", "int"); // % Check("x1 "34" QString"); // QTest::newRow("WTFString") // << Data( // "QWebPage p; -// % CheckType("p QWebPage"); +// % Check("p", "QWebPage"); // QTest::newRow("BoostOptional1") // << Data( // "boost::optional<int> i0, i; // "i = 1; -// % Check("i0 <uninitialized> boost::optional<int>"); -// % Check("i 1 boost::optional<int>"); +// % Check("i0", "<uninitialized>", "boost::optional<int>"); +// % Check("i", "1", "boost::optional<int>"); // QTest::newRow("BoostOptional2") // << Data( // "boost::optional<QStringList> sl0, sl;\n" // "sl = (QStringList() << "xxx" << "yyy");\n" // "sl.get().append("zzz");\n" -// % Check("sl <uninitialized> boost::optional<QStringList>"); +// % Check("sl", "<uninitialized>", "boost::optional<QStringList>"); // % Check("sl <3 items> boost::optional<QStringList>"); // QTest::newRow("BoostSharedPtr") @@ -3087,9 +3221,9 @@ void tst_Dumpers::dumper_data() // "boost::shared_ptr<int> i(new int(43));\n" // "boost::shared_ptr<int> j = i;\n" // "boost::shared_ptr<QStringList> sl(new QStringList(QStringList() << "HUH!")); -// % Check("s (null) boost::shared_ptr<int>"); -// % Check("i 43 boost::shared_ptr<int>"); -// % Check("j 43 boost::shared_ptr<int>"); +// % Check("s", "(null)", "boost::shared_ptr<int>"); +// % Check("i", "43", "boost::shared_ptr<int>"); +// % Check("j", "43", "boost::shared_ptr<int>"); // % Check("sl boost::shared_ptr<QStringList>"); // % Check("sl.data <1 items> QStringList @@ -3120,9 +3254,9 @@ void tst_Dumpers::dumper_data() // "time_duration d1(1, 0, 0);\n" // "time_duration d2(0, 1, 0);\n" // "time_duration d3(0, 0, 1);\n" -// % Check("d1 01:00:00 boost::posix_time::time_duration"); -// % Check("d2 00:01:00 boost::posix_time::time_duration"); -// % Check("d3 00:00:01 boost::posix_time::time_duration"); +// % Check("d1", "01:00:00", "boost::posix_time::time_duration"); +// % Check("d2", "00:01:00", "boost::posix_time::time_duration"); +// % Check("d3", "00:00:01", "boost::posix_time::time_duration"); // QTest::newRow("BoostBimap") // << Data( @@ -3171,9 +3305,9 @@ void tst_Dumpers::dumper_data() // "KRBase *ptr1 = new KRA;\n" // "KRBase *ptr2 = new KRB;\n" // "ptr2 = new KRB;\n" -// % CheckType("ptr1 KRBase"); +// % Check("ptr1", "KRBase"); // % Check("ptr1.type KRBase::TYPE_A (0) KRBase::Type"); -// % CheckType("ptr2 KRBase"); +// % Check("ptr2", "KRBase"); // % Check("ptr2.type KRBase::TYPE_B (1) KRBase::Type"); @@ -3231,10 +3365,10 @@ void tst_Dumpers::dumper_data() // "QMap<int, CustomStruct>::iterator it = map.begin();\n" // % Check("map <2 items> QMap<int, bug4904::CustomStruct>"); // % Check("map.0 QMapNode<int, bug4904::CustomStruct>"); -// % Check("map.0.key -1 int"); -// % CheckType("map.0.value bug4904::CustomStruct"); -// % Check("map.0.value.dvalue 3.1400000000000001 double"); -// % Check("map.0.value.id -1 int"); +// % Check("map.0.key", "-1", "int"); +// % Check("map.0.value", "bug4904::CustomStruct"); +// % Check("map.0.value.dvalue", "3.1400000000000001", "double"); +// % Check("map.0.value.id", "-1", "int"); // QTest::newRow("// https://bugreports.qt-project.org/browse/QTCREATORBUG-5106") @@ -3274,7 +3408,7 @@ void tst_Dumpers::dumper_data() // QNetworkRequest request(url);\n" // QList<QByteArray> raw = request.rawHeaderList();\n" // % Check("raw <0 items> QList<QByteArray>"); -// % CheckType("request QNetworkRequest"); +// % Check("request", "QNetworkRequest"); // % Check("url "http://127.0.0.1/" QUrl &"); // } @@ -3310,7 +3444,7 @@ void tst_Dumpers::dumper_data() // void helper(Object *obj) // { -// % CheckType("obj qc42170::Circle"); +// % Check("obj", "qc42170::Circle"); // // Continue"); // % Check("that obj is shown as a 'Circle' object"); @@ -3347,15 +3481,15 @@ void tst_Dumpers::dumper_data() // "typedef S1 Array[10];\n" // "Array a2;\n" // % CheckType("a1 bug5799::S1 [10]"); -// % CheckType("a2 bug5799::Array"); -// % CheckType("s2 bug5799::S2"); -// % CheckType("s2.@1 bug5799::S1"); -// % Check("s2.@1.m1 5 int"); -// % CheckType("s2.@1.m2 int"); -// % CheckType("s4 bug5799::S4"); -// % CheckType("s4.@1 bug5799::S3"); -// % Check("s4.@1.m1 5 int"); -// % CheckType("s4.@1.m2 int"); +// % Check("a2", "bug5799::Array"); +// % Check("s2", "bug5799::S2"); +// % Check("s2.@1", "bug5799::S1"); +// % Check("s2.@1.m1", "5", "int"); +// % Check("s2.@1.m2", "int"); +// % Check("s4", "bug5799::S4"); +// % Check("s4.@1", "bug5799::S3"); +// % Check("s4.@1.m1", "5", "int"); +// % Check("s4.@1.m2", "int"); // // http://www.qtcentre.org/threads/41700-How-to-watch-STL-containers-iterators-during-debugging @@ -3403,8 +3537,8 @@ void tst_Dumpers::dumper_data() // " f(3, 4);\n" -// % Check("c 3 int"); -// % Check("d 4 int"); +// % Check("c", "3", "int"); +// % Check("d", "4", "int"); // % Check("there are frames for g and f in the stack view"); @@ -3466,7 +3600,7 @@ void tst_Dumpers::dumper_data() // void setProp(QObject *obj)\n" // {\n" // obj->setProperty("foo", "bar"); -// % Check("obj.[QObject].properties <2 items>"); +// % Check("obj.[QObject].properties", "<2", "items>"); // // Continue"); // dummyStatement(&obj); // } @@ -3504,84 +3638,84 @@ void tst_Dumpers::dumper_data() // "Derived d;\n" // "Base *b = &d;\n" // % Check("b.[bug6933::Base].[vptr] -// % Check("b.b 42 int"); - - -// QTest::newRow("(const char *format, ...)\n" -// "va_list arg;\n" -// "va_start(arg, format);\n" -// "int i = va_arg(arg, int);\n" -// "double f = va_arg(arg, double);\n" -// "va_end(arg);\n" - -// QTest::newRow("VaList()") -// << Data("test(\"abc\", 1, 2.0);\n"); - - - - -// QTest::newRow("13393") -// << Data( -// "struct Base {\n" -// " Base() : a(1) {} -// " virtual ~Base() {} // Enforce type to have RTTI\n" -// " int a;\n" -// "};\n" - - -//" struct Derived : public Base {\n" -//" Derived() : b(2) {}\n" -//" int b;\n" -//" };\n" - -//" struct S\n" -//" {\n" -//" Base *ptr;\n" -//" const Base *ptrConst;\n" -//" Base &ref;\n" -//" const Base &refConst;\n" -//"\n" -//" S(Derived &d)\n" -//" : ptr(&d), ptrConst(&d), ref(d), refConst(d)\n" -//" {}\n" -//" };\n" -// "Derived d;\n" -// "S s(d);\n" -// "Base *ptr = &d;\n" -// "const Base *ptrConst = &d;\n" -// "Base &ref = d;\n" -// "const Base &refConst = d;\n" -// "Base **ptrToPtr = &ptr;\n" -// "#if USE_BOOST\n" -// "boost::shared_ptr<Base> sharedPtr(new Derived());\n" -// "#else\n" -// "int sharedPtr = 1;\n" -// "#endif\n" -// % CheckType("d gdb13393::Derived"); -// % CheckType("d.@1 gdb13393::Base"); -// % Check("d.b 2 int"); -// % CheckType("ptr gdb13393::Derived"); -// % CheckType("ptr.@1 gdb13393::Base"); -// % Check("ptr.@1.a 1 int"); -// % CheckType("ptrConst gdb13393::Derived"); -// % CheckType("ptrConst.@1 gdb13393::Base"); -// % Check("ptrConst.b 2 int"); -// % CheckType("ptrToPtr gdb13393::Derived"); -// % CheckType("ptrToPtr.[vptr] "); -// % Check("ptrToPtr.@1.a 1 int"); -// % CheckType("ref gdb13393::Derived"); -// % CheckType("ref.[vptr] "); -// % Check("ref.@1.a 1 int"); -// % CheckType("refConst gdb13393::Derived"); -// % CheckType("refConst.[vptr] "); -// % Check("refConst.@1.a 1 int"); -// % CheckType("s gdb13393::S"); -// % CheckType("s.ptr gdb13393::Derived"); -// % CheckType("s.ptrConst gdb13393::Derived"); -// % CheckType("s.ref gdb13393::Derived"); -// % CheckType("s.refConst gdb13393::Derived"); -// % Check("sharedPtr 1 int"); - +// % Check("b.b", "42", "int"); + + + QTest::newRow("valist") + << Data("#include <stdarg.h>\n" + "void test(const char *format, ...)\n" + "{\n" + " va_list arg;\n" + " va_start(arg, format);\n" + " int i = va_arg(arg, int);\n" + " double f = va_arg(arg, double);\n" + " dummyStatement(&i, &f);\n" + " va_end(arg);\n" + "}\n", + "test(\"abc\", 1, 2.0);\n") + % Check("i", "1", "int") + % Check("f", "2", "double"); + + + QTest::newRow("gdb13393") + << Data( + "struct Base {\n" + " Base() : a(1) {}\n" + " virtual ~Base() {} // Enforce type to have RTTI\n" + " int a;\n" + "};\n" + "struct Derived : public Base {\n" + " Derived() : b(2) {}\n" + " int b;\n" + "};\n" + "struct S\n" + "{\n" + " Base *ptr;\n" + " const Base *ptrConst;\n" + " Base &ref;\n" + " const Base &refConst;\n" + " S(Derived &d)\n" + " : ptr(&d), ptrConst(&d), ref(d), refConst(d)\n" + " {}\n" + " };\n" + , + "Derived d;\n" + "S s(d);\n" + "Base *ptr = &d;\n" + "const Base *ptrConst = &d;\n" + "Base &ref = d;\n" + "const Base &refConst = d;\n" + "Base **ptrToPtr = &ptr;\n" + "#if USE_BOOST\n" + "boost::shared_ptr<Base> sharedPtr(new Derived());\n" + "#else\n" + "int sharedPtr = 1;\n" + "#endif\n" + "dummyStatement(&ptrConst, &ref, &refConst, &ptrToPtr, &sharedPtr);\n") + % Check("d", "", "Derived") + % Check("d.@1", "[Base]", "", "Base") + % Check("d.b", "2", "int") + % Check("ptr", "", "Derived") + % Check("ptr.@1", "[Base]", "", "Base") + % Check("ptr.@1.a", "1", "int") + % Check("ptrConst", "", "Derived") + % Check("ptrConst.@1", "[Base]", "", "Base") + % Check("ptrConst.b", "2", "int") + % Check("ptrToPtr", "", "Derived") + //% CheckType("ptrToPtr.[vptr]", " ") + % Check("ptrToPtr.@1.a", "1", "int") + % Check("ref", "", "Derived &") + //% CheckType("ref.[vptr]", "") + % Check("ref.@1.a", "1", "int") + % Check("refConst", "", "Derived &") + //% CheckType("refConst.[vptr]", "") + % Check("refConst.@1.a", "1", "int") + % Check("s", "", "S") + % Check("s.ptr", "", "Derived") + % Check("s.ptrConst", "", "Derived") + % Check("s.ref", "", "Derived &") + % Check("s.refConst", "", "Derived &") + % Check("sharedPtr", "1", "int"); // http://sourceware.org/bugzilla/show_bug.cgi?id=10586. fsf/MI errors out @@ -3589,23 +3723,25 @@ void tst_Dumpers::dumper_data() // The proposed fix has been reported to crash gdb steered from eclipse"); // http://sourceware.org/ml/gdb-patches/2011-12/msg00420.html QTest::newRow("gdb10586mi") - << Data("struct test {\n" + << Data("struct Test {\n" " struct { int a; float b; };\n" " struct { int c; float d; };\n" - "} v = {{1, 2}, {3, 4}};\n") - % Check("v gdb10586::test") - % Check("v.a 1 int"); + "} v = {{1, 2}, {3, 4}};\n" + "dummyStatement(&v);\n") + % Check("v", "", "Test") + % Check("v.a", "1", "int"); QTest::newRow("gdb10586eclipse") << Data("struct { int x; struct { int a; }; struct { int b; }; } v = {1, {2}, {3}};\n" - "struct s { int x, y; } n = {10, 20};\n") - % CheckType("v {...}") - % CheckType("n gdb10586::s") - % Check("v.a 2 int") - % Check("v.b 3 int") - % Check("v.x 1 int") - % Check("n.x 10 int") - % Check("n.y 20 int"); + "struct S { int x, y; } n = {10, 20};\n" + "dummyStatement(&v, &n);\n") + % Check("v", "", "{...}") + % Check("n", "", "S") + % Check("v.a", "2", "int") + % Check("v.b", "3", "int") + % Check("v.x", "1", "int") + % Check("n.x", "10", "int") + % Check("n.y", "20", "int"); } -- GitLab