Commit cb1275fa authored by hjk's avatar hjk

Debugger: Work on dumper auto tests

Change-Id: I3df1faef35fec270094fdfbcb360216f516d0208
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 339bc28d
......@@ -1371,7 +1371,9 @@ class Dumper:
if not hasPlot():
return
if not isSimpleType(type):
self.putValue(self.currentValue + " (not plottable)")
#self.putValue(self.currentValue + " (not plottable)")
self.putValue(self.currentValue)
self.putField("plottable", "0")
return
global gnuplotPipe
global gnuplotPid
......
......@@ -1840,7 +1840,8 @@ def qdump__QWeakPointer(d, value):
d.putNumChild(3)
if d.isExpanded():
with Children(d):
d.putSubItem("data", val.dereference())
innerType = templateArgument(value.type, 0)
d.putSubItem("data", val.dereference().cast(innerType))
d.putIntItem("weakref", weakref)
d.putIntItem("strongref", strongref)
......
......@@ -42,10 +42,32 @@ using namespace Internal;
static QByteArray noValue = "\001";
static QByteArray nameFromIName(const QByteArray &iname)
struct Name
{
Name()
: name(noValue)
{}
Name(const char *str)
: name(str)
{}
Name(const QByteArray &ba)
: name(ba)
{}
bool matches(const QByteArray &actualName0, const QByteArray &nameSpace) const
{
QByteArray actualName = actualName0;
QByteArray expectedName = name;
expectedName.replace('@', nameSpace);
return actualName == expectedName;
}
QByteArray name;
};
static Name nameFromIName(const QByteArray &iname)
{
int pos = iname.lastIndexOf('.');
return pos == -1 ? iname : iname.mid(pos + 1);
return Name(pos == -1 ? iname : iname.mid(pos + 1));
}
static QByteArray parentIName(const QByteArray &iname)
......@@ -115,38 +137,30 @@ struct Type
QByteArray type;
};
struct Deque : Type
{
Deque(const QByteArray &inner)
: Type("std::deque<" + inner + ", std::allocator<" + inner + ">>")
{}
};
struct Check
{
Check() {}
Check(const QByteArray &iname, const Value &value,
const Type &type)
Check(const QByteArray &iname, const Value &value, const Type &type)
: iname(iname), expectedName(nameFromIName(iname)),
expectedValue(value), expectedType(type)
{}
Check(const QByteArray &iname, const QByteArray &name,
Check(const QByteArray &iname, const Name &name,
const Value &value, const Type &type)
: iname(iname), expectedName(name),
expectedValue(value), expectedType(type)
{}
QByteArray iname;
QByteArray expectedName;
Name expectedName;
Value expectedValue;
Type expectedType;
};
struct CheckType : public Check
{
CheckType(const QByteArray &iname, const QByteArray &name,
CheckType(const QByteArray &iname, const Name &name,
const Type &type)
: Check(iname, name, noValue, type)
{}
......@@ -255,18 +269,19 @@ void tst_Dumpers::dumper()
QFile source(buildDir.path() + QLatin1Char('/') + QLatin1String(mainFile));
ok = source.open(QIODevice::ReadWrite);
QVERIFY(ok);
source.write(
"\n\nvoid dummyStatement(void *first,...) { (void) first; }"
QByteArray fullCode =
"\n\nvoid unused(void *first,...) { (void) first; }"
"\n\n" + data.includes +
"\n\nvoid stopper() {}"
"\n\nvoid breakHere() {}"
"\n\nint main(int argc, char *argv[])"
"\n{"
"\n dummyStatement(&argc, &argv);\n"
"\n " + data.code +
"\n stopper();"
"\n unused(&argc, &argv);\n"
"\n" + data.code +
"\n breakHere();"
"\n return 0;"
"\n}\n");
"\n}\n";
QVERIFY(ok);
source.write(fullCode);
source.close();
QProcess qmake;
......@@ -291,7 +306,14 @@ void tst_Dumpers::dumper()
output = make.readAllStandardOutput();
error = make.readAllStandardError();
//qDebug() << "stdout: " << output;
if (!error.isEmpty()) { qDebug() << error; QVERIFY(false); }
if (!error.isEmpty()) {
qDebug() << error;
qDebug() << "\n------------------ CODE --------------------";
qDebug() << fullCode;
qDebug() << "\n------------------ CODE --------------------";
qDebug() << ".pro: " << qPrintable(proFile.fileName());
QVERIFY(false);
}
QByteArray dumperDir = DUMPERDIR;
......@@ -319,7 +341,8 @@ void tst_Dumpers::dumper()
QByteArray cmds =
"set confirm off\n"
"file doit\n"
"break stopper\n"
"break breakHere\n"
"set print object on\n"
"set auto-load python-scripts off\n"
"python execfile('" + dumperDir + "/bridge.py')\n"
"python execfile('" + dumperDir + "/dumper.py')\n"
......@@ -393,10 +416,10 @@ void tst_Dumpers::dumper()
foreach (const WatchData &item, list) {
if (data.checks.contains(item.iname)) {
Check check = data.checks.take(item.iname);
if (item.name.toLatin1() != check.expectedName) {
if (!check.expectedName.matches(item.name.toLatin1(), nameSpace)) {
qDebug() << "INAME : " << item.iname;
qDebug() << "NAME ACTUAL : " << item.name;
qDebug() << "NAME EXPECTED: " << check.expectedName;
qDebug() << "NAME ACTUAL : " << item.name.toLatin1();
qDebug() << "NAME EXPECTED: " << check.expectedName.name;
qDebug() << "CONTENTS : " << contents;
QVERIFY(false);
}
......@@ -511,7 +534,7 @@ void tst_Dumpers::dumper_data()
" ba.append(char(i));\n"
"QString s(10000, 'x');\n"
"std::string ss(10000, 'c');\n"
"dummyStatement(&ba, &s, &ss);\n")
"unused(&ba, &s, &ss);\n")
% CheckType("ba", "@QByteArray")
% Check("s", '"' + QByteArray(10000, 'x') + '"', "@QString")
% Check("ss", '"' + QByteArray(10000, 'c') + '"', "std::string");
......@@ -524,7 +547,7 @@ void tst_Dumpers::dumper_data()
"QByteArray buf1(str1);\n"
"QByteArray buf2(str2);\n"
"QByteArray buf3(str3);\n"
"dummyStatement(&buf1, &buf2, &buf3);\n")
"unused(&buf1, &buf2, &buf3);\n")
% Check("buf1", "\"" + QByteArray(1, 0xee) + "\"", "@QByteArray")
% Check("buf2", "\"" + QByteArray(1, 0xee) + "\"", "@QByteArray")
% Check("buf3", "\"\ee\"", "@QByteArray")
......@@ -541,14 +564,14 @@ void tst_Dumpers::dumper_data()
QTest::newRow("QDate0")
<< Data("#include <QDate>\n",
"QDate date;\n"
"dummyStatement(&date);\n")
"unused(&date);\n")
% Check("date", "(invalid)", "@QDate");
QTest::newRow("QDate1")
<< Data("#include <QDate>\n",
"QDate date;\n"
"date.setDate(1980, 1, 1);\n"
"dummyStatement(&date);\n")
"unused(&date);\n")
% Check("date", "Tue Jan 1 1980", "@QDate")
% Check("date.(ISO)", "\"1980-01-01\"", "@QString")
% CheckType("date.(Locale)", "@QString")
......@@ -785,7 +808,7 @@ void tst_Dumpers::dumper_data()
"pain.drawLine(2, 2, 130, 130);\n"
"pain.end();\n"
"QPixmap pm = QPixmap::fromImage(im);\n"
"dummyStatement(&pm);\n")
"unused(&pm);\n")
% GuiProfile()
% Check("im", "(200x200)", "@QImage")
% CheckType("pain", "@QPainter")
......@@ -995,7 +1018,7 @@ void tst_Dumpers::dumper_data()
<< Data("#include <QLocale>\n",
"QLocale loc = QLocale::system();\n"
"QLocale::MeasurementSystem m = loc.measurementSystem();\n"
"dummyStatement(&m);\n")
"unused(&m);\n")
% Check("loc", "", "@QLocale")
% Check("m", "", "@QLocale::MeasurementSystem");
......@@ -1399,7 +1422,7 @@ void tst_Dumpers::dumper_data()
"QString dummy;\n"
"QPoint s0, s;\n"
"s = QPoint(100, 200);\n"
"dummyStatement(&s0, &s);\n")
"unused(&s0, &s);\n")
% Check("s0", "(0, 0)", "@QPoint")
% Check("s", "(100, 200)", "@QPoint");
......@@ -1452,33 +1475,27 @@ void tst_Dumpers::dumper_data()
<< Data("#include <QRegion>\n"
"#include <QString> // Dummy for namespace\n",
"QString dummy;\n"
"QRegion region, region0, region1, region2, region4;\n"
"region += QRect(100, 100, 200, 200);\n"
"QRegion region, region0, region1, region2;\n"
"region0 = region;\n"
"region += QRect(300, 300, 400, 500);\n"
"region += QRect(100, 100, 200, 200);\n"
"region1 = region;\n"
"region += QRect(500, 500, 600, 600);\n"
"region2 = region;\n")
% 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");
"region += QRect(300, 300, 400, 500);\n"
"region2 = region;\n"
"unused(&region0, &region1, &region2);\n")
% Profile("QT += gui\n")
% Check("region0", "<empty>", "@QRegion")
% Check("region1", "<1 items>", "@QRegion")
% Check("region1.extents", "200x200+100+100", "@QRect")
% Check("region1.innerArea", "40000", "int")
% Check("region1.innerRect", "200x200+100+100", "@QRect")
% Check("region1.numRects", "1", "int")
% Check("region1.rects", "<0 items>", "@QVector<@QRect>")
% Check("region2", "<2 items>", "@QRegion")
% Check("region2.extents", "600x700+100+100", "@QRect")
% Check("region2.innerArea", "200000", "int")
% Check("region2.innerRect", "400x500+300+300", "@QRect")
% Check("region2.numRects", "2", "int")
% Check("region2.rects", "<2 items>", "@QVector<@QRect>");
QTest::newRow("QSettings")
<< Data("#include <QRegExp>\n",
......@@ -1521,7 +1538,6 @@ void tst_Dumpers::dumper_data()
% Check("s", "<1 items>", "@QSet<@QPointer<@QObject>>")
% Check("s.0", "[0]", "", "@QPointer<@QObject>");
QByteArray sharedData =
" class EmployeeData : public QSharedData\n"
" {\n"
......@@ -1564,16 +1580,23 @@ void tst_Dumpers::dumper_data()
"QSharedPointer<int> ptr;\n"
"QSharedPointer<int> ptr2 = ptr;\n"
"QSharedPointer<int> ptr3 = ptr;\n"
"dummyStatement(&ptr, &ptr2, &ptr3);\n")
% Check("ptr", "(invalid)", "@QSharedPointer<int>");
"unused(&ptr, &ptr2, &ptr3);\n")
% Check("ptr", "(null)", "@QSharedPointer<int>")
% Check("ptr2", "(null)", "@QSharedPointer<int>")
% Check("ptr3", "(null)", "@QSharedPointer<int>");
QTest::newRow("QSharedPointer2")
<< Data("#include <QSharedPointer>\n",
"QSharedPointer<QString> ptr(new QString(\"hallo\"));\n"
"QSharedPointer<QString> ptr2 = ptr;\n"
"QSharedPointer<QString> ptr3 = ptr;\n"
"dummyStatement(&ptr, &ptr2, &ptr3);\n")
% Check("ptr", "\"hallo\"", "@QSharedPointer<@QString>");
"unused(&ptr, &ptr2, &ptr3);\n")
% Check("ptr", "", "@QSharedPointer<@QString>")
% Check("ptr.data", "\"hallo\"", "@QString")
% Check("ptr.weakref", "3", "int")
% Check("ptr.strongref", "3", "int")
% Check("ptr2.data", "\"hallo\"", "@QString")
% Check("ptr3.data", "\"hallo\"", "@QString");
QTest::newRow("QSharedPointer3")
<< Data("#include <QSharedPointer>\n",
......@@ -1581,8 +1604,13 @@ void tst_Dumpers::dumper_data()
"QWeakPointer<int> ptr(iptr);\n"
"QWeakPointer<int> ptr2 = ptr;\n"
"QWeakPointer<int> ptr3 = ptr;\n"
"dummyStatement(&ptr, &ptr2, &ptr3);\n")
% Check("ptr3", "43", "@QSharedPointer<int>");
"unused(&ptr, &ptr2, &ptr3);\n")
% Check("iptr", "", "@QSharedPointer<int>")
% Check("iptr.data", "43", "int")
% Check("iptr.weakref", "4", "int")
% Check("iptr.strongref", "1", "int")
% Check("ptr3", "43", "int")
% Check("ptr3.data", "43", "int");
QTest::newRow("QSharedPointer4")
<< Data("#include <QSharedPointer>\n"
......@@ -1591,8 +1619,10 @@ void tst_Dumpers::dumper_data()
"QWeakPointer<QString> ptr(sptr);\n"
"QWeakPointer<QString> ptr2 = ptr;\n"
"QWeakPointer<QString> ptr3 = ptr;\n"
"dummyStatement(&ptr, &ptr2, &ptr3);\n")
% Check("ptr", "(invalid)", "@QSharedPointer<QString>");
"unused(&ptr, &ptr2, &ptr3);\n")
% Check("sptr", "", "@QSharedPointer<@QString>")
% Check("sptr.data", "\"hallo\"", "@QString")
% Check("ptr3", "", "@QWeakPointer<@QString>");
QTest::newRow("QSharedPointer5")
<< Data("#include <QSharedPointer>\n" + fooData,
......@@ -1600,8 +1630,10 @@ void tst_Dumpers::dumper_data()
"QWeakPointer<Foo> ptr(fptr);\n"
"QWeakPointer<Foo> ptr2 = ptr;\n"
"QWeakPointer<Foo> ptr3 = ptr;\n"
"dummyStatement(&ptr, &ptr2, &ptr3);\n")
% Check("ptr", "(invalid)", "@QSharedPointer<Foo>");
"unused(&ptr, &ptr2, &ptr3);\n")
% Check("fptr", "", "@QSharedPointer<Foo>")
% Check("fptr.data", "", "Foo")
% Check("ptr3", "", "@QWeakPointer<Foo>");
QTest::newRow("QXmlAttributes")
<< Data("#include <QXmlAttributes>\n",
......@@ -1609,10 +1641,11 @@ 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")
% Check("atts", "", "QXmlAttributes")
% Profile("QT += xml\n")
% Check("atts", "", "@QXmlAttributes")
% CheckType("atts.[vptr]", "")
% Check("atts.attList", "<3 items>", "@QXmlAttributes::AttributeList")
% Check("atts.attList.0", "[0]", "", "QXmlAttributes::Attribute")
% Check("atts.attList.0", "[0]", "", "@QXmlAttributes::Attribute")
% Check("atts.attList.0.localname", "\"localPart1\"", "@QString")
% Check("atts.attList.0.qname", "\"name1\"", "@QString")
% Check("atts.attList.0.uri", "\"uri1\"", "@QString")
......@@ -1647,7 +1680,7 @@ void tst_Dumpers::dumper_data()
"// Doesn't work when compiled as C++.\n"
"double complex a = 0;\n"
"double _Complex b = 0;\n"
"dummyStatement(&a, &b);\n")
"unused(&a, &b);\n")
% ForceC()
% Check("a", "0 + 0 * I", "complex double")
% Check("b", "0 + 0 * I", "complex double");
......@@ -1657,7 +1690,7 @@ void tst_Dumpers::dumper_data()
"std::deque<int> deque;\n"
"deque.push_back(1);\n"
"deque.push_back(2);\n")
% Check("deque", "<2 items>", Deque("int"))
% Check("deque", "<2 items>", "std::deque<int>")
% Check("deque.0", "[0]", "1", "int")
% Check("deque.1", "[1]", "2", "int");
......@@ -1670,7 +1703,7 @@ void tst_Dumpers::dumper_data()
"deque.push_back(new int(3));\n"
"deque.pop_back();\n"
"deque.pop_front();\n")
% Check("deque", "<2 items>", Deque("int *"))
% Check("deque", "<2 items>", "std::deque<int *>")
% Check("deque.0", "[0]", "0x0", "int *")
% Check("deque.1", "[1]", "2", "int");
......@@ -1679,7 +1712,7 @@ void tst_Dumpers::dumper_data()
"std::deque<Foo> deque;\n"
"deque.push_back(1);\n"
"deque.push_front(2);\n")
% Check("deque", "<2 items>", Deque("Foo"))
% Check("deque", "<2 items>", "std::deque<Foo>")
% Check("deque.0", "[0]", "", "Foo")
% Check("deque.0.a", "2", "int")
% Check("deque.1", "[1]", "", "Foo")
......@@ -1690,7 +1723,7 @@ void tst_Dumpers::dumper_data()
"std::deque<Foo *> deque;\n"
"deque.push_back(new Foo(1));\n"
"deque.push_back(new Foo(2));\n")
% Check("deque", "<2 items>", Deque("Foo*"))
% Check("deque", "<2 items>", "std::deque<Foo*>")
% Check("deque.0", "[0]", "", "Foo")
% Check("deque.0.a", "1", "int")
% Check("deque.1", "[1]", "", "Foo")
......@@ -1822,25 +1855,27 @@ void tst_Dumpers::dumper_data()
"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", "[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.0.second.0", "[0]", "\"11\"", "@QString")
% Check("map.1", "[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.1.second.0", "[0]", "\"22\"", "@QString");
QTest::newRow("StdMapUIntStringListTypedef")
<< Data("#include <map>\n",
<< Data("#include <map>\n"
"#include <QStringList>\n",
"typedef std::map<uint, QStringList> T;\n"
"T map;\n"
"map[11] = QStringList() << \"11\";\n"
"map[22] = QStringList() << \"22\";\n");
"map[22] = QStringList() << \"22\";\n")
% Check("map.1.second.0", "[0]", "\"22\"", "@QString");
QTest::newRow("StdMapUIntFloat")
<< Data("#include <map>\n",
"std::map<uint, float> map;\n"
"std::map<unsigned int, float> map;\n"
"map[11] = 11.0;\n"
"map[22] = 22.0;\n")
% Check("map", "<2 items>", "std::map<unsigned int, float>")
......@@ -1871,7 +1906,8 @@ void tst_Dumpers::dumper_data()
% Check("it6.second", "66", "float");
QTest::newRow("StdMapStringFloat")
<< Data("#include <map>\n",
<< Data("#include <map>\n"
"#include <QString>\n",
"std::map<QString, float> map;\n"
"map[\"11.0\"] = 11.0;\n"
"map[\"22.0\"] = 22.0;\n")
......@@ -2152,7 +2188,8 @@ void tst_Dumpers::dumper_data()
% Check("vector.3", "[3]", "0x0", "std::list<int> *");
QTest::newRow("StdStream")
<< Data("#include <ifstream>\n",
<< Data("#include <istream>\n"
"#include <fstream>\n",
"using namespace std;\n"
"ifstream is0, is;\n"
"#ifdef Q_OS_WIN\n"
......@@ -2160,7 +2197,8 @@ void tst_Dumpers::dumper_data()
"#else\n"
" is.open(\"/etc/passwd\");\n"
"#endif\n"
" bool ok = is.good();\n")
"bool ok = is.good();\n"
"unused(&ok, &is, &is0);\n")
% Check("is", "", "std::ifstream")
% Check("ok", "true", "bool");
......@@ -2275,7 +2313,7 @@ void tst_Dumpers::dumper_data()
QTest::newRow("QString3")
<< Data("#include <QString>\n"
"void stringRefTest(const QString &refstring) { stopper(); }\n",
"void stringRefTest(const QString &refstring) { breakHere(); }\n",
"stringRefTest(QString(\"Ref String Test\"));\n")
% Check("refstring", "\"Ref String Test\"", "@QString &");
......@@ -2284,7 +2322,7 @@ void tst_Dumpers::dumper_data()
"QString str = \"Hello \";\n"
"QString string(\"String Test\");\n"
"QString *pstring = new QString(\"Pointer String Test\");\n"
"dummyStatement(&str, &string, &pstring);\n")
"unused(&str, &string, &pstring);\n")
% Check("pstring", "\"Pointer String Test\"", "@QString")
% Check("str", "\"Hello \"", "@QString")
% Check("string", "\"String Test\"", "@QString");
......@@ -2349,37 +2387,45 @@ void tst_Dumpers::dumper_data()
% CheckType("t", "char [6]")
% CheckType("w", "wchar_t [4]");
QTest::newRow("Text")
<< Data("#include <QApplication>\n"
"#include <QTextCursor>\n"
"#include <QTextDocument>\n",
"QApplication app(arrc, argv)\n"
"QApplication app(argc, 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")
"int anc = tc.anchor();\n"
"unused(&pos, &anc);\n")
% Profile("QT += gui")
% CheckType("doc", "@QTextDocument")
% Check("tc", "4", "@QTextCursor")
% Check("pos", "4", "int")
% Check("anc", "1", "int");
QTest::newRow("QThread")
QTest::newRow("QThread1")
<< Data("#include <QThread>\n",
"struct Thread : QThread\n"
"{\n"
" void run()\n"
" {\n"
" if (m_id == 3)\n"
" breakHere();\n"
" }\n"
" int m_id;\n"
"};\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].m_id = i;\n"
" thread[i].setObjectName(\"This is thread #\" + QString::number(i));\n"
" thread[i].start();\n"
"}\n")
% 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");
% CheckType("this", "Thread")
% Check("this.@1", "[@QThread]", "", "@QThread")
% Check("this.@1.@1", "[@QObject]", "\"This is thread #3\"", "@QObject");
QTest::newRow("QVariant1")
<< Data("#include <QVariant>\n",
......@@ -2447,10 +2493,9 @@ void tst_Dumpers::dumper_data()
QTest::newRow("QVariant3")
<< Data("#include <QVariant>\n",
"QVariant var;\n"
"dummyStatement(&var);\n")
"unused(&var);\n")
% Check("var", "(invalid)", "@QVariant (invalid)");
QTest::newRow("QVariant4")
<< Data("#include <QHostAddress>\n"
"#include <QVariant>\n"
......@@ -2494,7 +2539,7 @@ void tst_Dumpers::dumper_data()
"my[3] = (QStringList() << \"World\");\n"
"QVariant var;\n"
"var.setValue(my);\n"
"stopper();\n")
"breakHere();\n")
% Check("my", "<2 items>", "MyType")
% Check("my.0", "[0]", "", "@QMapNode<unsigned int, @QStringList>")
% Check("my.0.key", "1", "unsigned int")
......@@ -2522,7 +2567,7 @@ void tst_Dumpers::dumper_data()
"QList<int> list;\n"
"list << 1 << 2 << 3;\n"
"QVariant variant = qVariantFromValue(list);\n"
"dummyStatement(&list, &variant);\n")
"unused(&list, &variant);\n")
% Check("list", "<3 items>", "@QList<int>")
% Check("list.0", "[0]", "1", "int")
% Check("list.1", "[1]", "2", "int")
......@@ -2533,14 +2578,6 @@ void tst_Dumpers::dumper_data()
% Check("variant.data.1", "[1]", "2", "int")
% Check("variant.data.2", "[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");
// QTest::newRow("QVariantList")
// << Data(
// "QVariantList vl;\n"
......@@ -2619,7 +2656,7 @@ void tst_Dumpers::dumper_data()
// "FooVector vec;\n"
// "vec.append(Foo(2));\n"
// "vec.append(Foo(3));\n"
// dummyStatement(&vec);
// unused(&vec);
// }
// QTest::newRow("QVectorFooStar")
......@@ -2820,45 +2857,25 @@ void tst_Dumpers::dumper_data()
// anon.doit(1);\n"
// foo.doit(1);\n"
// bar.doit(1);\n"
// dummyStatement();\n"
// unused();\n"
// }
// QTest::newRow("GccExtensions")
// "#ifdef __GNUC__\n"
// "char v[8] = { 1, 2 };\n"
// "char w __attribute__ ((vector_size (8))) = { 1, 2 };\n"
// "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");
//class Z : public QObject
//{
//public:
// Z() {
// f = new Foo();
// i = 0;
// i = 1;
// i = 2;
// i = 3;
// }
// int i;
// Foo *f;
//};
//QString fooxx()
//{
// return "bababa";
//}
QTest::newRow("GccExtensions")
<< Data(
"char v[8] = { 1, 2 };\n"
"char w __attribute__ ((vector_size (8))) = { 1, 2 };\n"
"int y[2] = { 1, 2 };\n"
"int z __attribute__ ((vector_size (8))) = { 1, 2 };\n"
"unused(&v, &w, &y, &z);\n")
% Check("v.0", "[0]", "1", "char")
% Check("v.1", "[1]", "2", "char")
% Check("w.0", "[0]", "1", "char")
% Check("w.1", "[1]", "2", "char")
% Check("y.0", "[0]", "1", "int")
% Check("y.1", "[1]", "2", "int")
% Check("z.0", "[0]", "1", "int")
% Check("z.1", "[1]", "2", "int");
QTest::newRow("Int")
......@@ -2874,7 +2891,7 @@ void tst_Dumpers::dumper_data()
"quint32 u32s = 0;\n"
"qint32 s32s = LONG_MIN;\n"