aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2018-01-30 14:18:45 +0100
committerhjk <hjk@qt.io>2018-01-31 14:19:23 +0000
commita42ae9e6f59e7f2eb273ef1735a9ebaac50c8b08 (patch)
treeb0d7c60c9246a33cfcd29958550237fe2646520a /tests
parenta8f9ca6ca8ea0eee5155d92b01d67f17ba1e43fa (diff)
Debugger: Add the ability to auto-test expression evaluation
... and use it for the hidden "sequence" feature. Change-Id: I3430a24774264a573687ee818064314a8bca7212 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/debugger/tst_dumpers.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp
index 743197ff09..2009eb5ab8 100644
--- a/tests/auto/debugger/tst_dumpers.cpp
+++ b/tests/auto/debugger/tst_dumpers.cpp
@@ -480,19 +480,26 @@ struct DumperOptions
QString options;
};
+struct Watcher : DumperOptions
+{
+ Watcher(const QString &iname, const QString &exp)
+ : DumperOptions(QString("\"watchers\":[{\"exp\":\"%2\",\"iname\":\"%1\"}]").arg(iname, toHex(exp)))
+ {}
+};
+
struct Check
{
Check() {}
- Check(const QString &iname, const Value &value, const Type &type)
- : iname(iname), expectedName(nameFromIName(iname)),
- expectedValue(value), expectedType(type)
+ Check(const QString &iname, const Name &name, const Value &value, const Type &type)
+ : iname(iname.startsWith("watch") ? iname : "local." + iname),
+ expectedName(name),
+ expectedValue(value),
+ expectedType(type)
{}
- Check(const QString &iname, const Name &name,
- const Value &value, const Type &type)
- : iname(iname), expectedName(name),
- expectedValue(value), expectedType(type)
+ Check(const QString &iname, const Value &value, const Type &type)
+ : Check(iname, nameFromIName(iname), value, type)
{}
bool matches(DebuggerEngine engine, int debuggerVersion, const Context &context) const
@@ -1455,7 +1462,7 @@ void tst_Dumpers::dumper()
parent = parentIName(parent);
if (parent.isEmpty())
break;
- expandedINames.insert("local." + parent);
+ expandedINames.insert(parent);
}
}
@@ -1670,7 +1677,7 @@ void tst_Dumpers::dumper()
for (int i = data.checks.size(); --i >= 0; ) {
Check check = data.checks.at(i);
- QString iname = "local." + check.iname;
+ const QString iname = check.iname;
WatchItem *item = static_cast<WatchItem *>(local.findAnyChild([iname](Utils::TreeItem *item) {
return static_cast<WatchItem *>(item)->internalName() == iname;
}));
@@ -6985,6 +6992,14 @@ void tst_Dumpers::dumper_data()
+ Check("c", FloatValue("0"), TypeDef("double", "long double"))
+ Check("d", FloatValue("0.5"), TypeDef("double", "long double"));
+ QTest::newRow("WatchList")
+ << Data("", "")
+ + Watcher("watch.1", "42;43")
+ + Check("watch.1", "42;43", "<2 items>", "")
+ + Check("watch.1.0", "42", "42", "int")
+ + Check("watch.1.1", "43", "43", "int");
+
+
#ifdef Q_OS_LINUX
QTest::newRow("StaticMembersInLib")
// We don't seem to have such in the public interface.