Commit 1287fcaa authored by hjk's avatar hjk
Browse files

Debugger: Allow type patterns in auto tests



This makes it easier to brush over harmless platform output differences
like the '4u' vs '4ul' in the std::array test

Change-Id: Id16e06afdb19dfc905658c34d5c2af401fd6a725
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 6ec8838f
......@@ -302,9 +302,9 @@ struct UnsubstitutedValue : Value
struct Type
{
Type() : qtVersion(0) {}
Type(const char *str) : type(str), qtVersion(0) {}
Type(const QByteArray &ba) : type(ba), qtVersion(0) {}
Type() : qtVersion(0), isPattern(false) {}
Type(const char *str) : type(str), qtVersion(0), isPattern(false) {}
Type(const QByteArray &ba) : type(ba), qtVersion(0), isPattern(false) {}
bool matches(const QByteArray &actualType0, const Context &context) const
{
......@@ -329,10 +329,16 @@ struct Type
expectedType.replace(' ', "");
expectedType.replace("const", "");
expectedType.replace('@', context.nameSpace);
if (isPattern) {
QString actual = QString::fromLatin1(actualType);
QString expected = QString::fromLatin1(expectedType);
return QRegExp(expected).exactMatch(actual);
}
return actualType == expectedType;
}
QByteArray type;
int qtVersion;
bool isPattern;
};
struct Type4 : Type
......@@ -345,6 +351,11 @@ struct Type5 : Type
Type5(const QByteArray &ba) : Type(ba) { qtVersion = 5; }
};
struct Pattern : Type
{
Pattern(const QByteArray &ba) : Type(ba) { isPattern = true; }
};
enum DebuggerEngine
{
DumpTestGdbEngine = 0x01,
......@@ -2575,8 +2586,8 @@ void tst_Dumpers::dumper_data()
% CoreProfile()
% Cxx11Profile()
% MacLibCppProfile()
% Check("a", "<4 items>", "std::array<int, 4u>")
% Check("b", "<4 items>", "std::array<@QString, 4u>");
% Check("a", "<4 items>", Pattern("std::array<int, 4u.*>"))
% Check("b", "<4 items>", Pattern("std::array<@QString, 4u.*>"));
QTest::newRow("StdComplex")
<< Data("#include <complex>\n",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment