From ea4b5429bbc1281394d5d1aac82f9fdebc5b2d90 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 4 May 2017 23:55:07 +0300 Subject: Dumpers: Add a failing test for string display() Change-Id: Ib70761ffcd76bdfed7879c222d471b50a8b32c0b --- share/qtcreator/debugger/misctypes.py | 8 ++++++++ tests/auto/debugger/tst_dumpers.cpp | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/share/qtcreator/debugger/misctypes.py b/share/qtcreator/debugger/misctypes.py index 30c5985e5e..f19debfe4a 100644 --- a/share/qtcreator/debugger/misctypes.py +++ b/share/qtcreator/debugger/misctypes.py @@ -381,3 +381,11 @@ def qdump__QtcDumperTest_BufArray(d, value): for i in d.childRange(): d.putSubItem(i, (buffer + (i * objsize)).dereference().cast(valueType)) + +def qdump__QtcDumperTest_String(d, value): + with Children(d): + first = d.hexdecode(d.putSubItem('first', value['first']).value) + second = d.hexdecode(d.putSubItem('second', value['second']).value) + third = d.hexdecode(d.putSubItem('third', value['third']).value)[:-1] + d.putValue(first + ', ' + second + ', ' + third) + diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 6fe3d99bdd..8f2f9087af 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -6846,6 +6846,25 @@ void tst_Dumpers::dumper_data() + Check("arr.2.baz", "5", "int"); + QTest::newRow("StringDisplay") + << Data("#include \n" + "struct QtcDumperTest_String" + "{\n" + " char *first;\n" + " const char *second = \"second\";\n" + " const char third[6] = \"third\";\n" + " QtcDumperTest_String()\n" + " {\n" + " first = new char[6];\n" + " strcpy(first, \"first\");\n" + " }\n" + " ~QtcDumperTest_String() { delete[] first; }\n" + "};\n\n", + "QtcDumperTest_String str; unused(&str);\n") + + Cxx11Profile() + + Check("str", "first, second, third", "QtcDumperTest_String"); + + QTest::newRow("UndefinedStaticMembers") << Data("struct Foo { int a = 15; static int b; }; \n", "Foo f; unused(&f);\n") -- cgit v1.2.1