From cf7fa03866b88e36ace93fabad3428905066ce4c Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 26 Jun 2019 13:48:15 +0200 Subject: [PATCH] Add tests for printers with custom allocators Add tests for the cases where std::vector and std::basic_string are used with custom allocators, which were fixed by commits 01f26bd5b748a7b2257debd0f6d35fb15fcaa284 ("Fix std::vector printer with custom allocator") and 5eba3bde9369fa084f2fe4d935f302ea2061db83 ("Fix std::basic_string printer with custom allocator"). Change-Id: I4de9de551d329b7d2ea821d09b04d39da13f1edf Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 3b59a9cce8b..c912f726aad 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -4804,6 +4804,17 @@ void tst_Dumpers::dumper_data() + Check("s3.1.a", "2", "int"); + QTest::newRow("StdBasicString") + << Data("#include \n" + "template\n" + "class myallocator : public std::allocator {};\n", + "std::basic_string, myallocator> str(\"hello\");\n" + "unused(&str);\n") + + Check("str", "\"hello\"", "std::basic_string, myallocator >") + + Check("str.0", "[0]", "104", "char") // 104: ASCII 'h' + + Check("str.1", "[1]", "101", "char"); // 101: ASCII 'e' + + QTest::newRow("StdString") << Data("#include \n", "std::string str0, str;\n" @@ -4925,7 +4936,9 @@ void tst_Dumpers::dumper_data() QTest::newRow("StdVector") << Data("#include \n" - "#include \n", + "#include \n" + "template\n" + "class myallocator : public std::allocator {};\n", "std::vector v0, v1;\n" "v1.push_back(1);\n" @@ -4970,7 +4983,12 @@ void tst_Dumpers::dumper_data() "unused(&b2);\n\n" "std::vector b3(300);\n" - "unused(&b3);\n") + "unused(&b3);\n" + + "std::vector> b4;\n" + "b4.push_back(true);\n" + "b4.push_back(false);\n" + "unused(&b4);\n") + Check("v0", "<0 items>", "std::vector") + Check("v1", "<3 items>", "std::vector") @@ -5010,8 +5028,11 @@ void tst_Dumpers::dumper_data() + Check("b3", "<300 items>", "std::vector") + Check("b3.0", "[0]", "0", "bool") - + Check("b3.299", "[299]", "0", "bool"); + + Check("b3.299", "[299]", "0", "bool") + + Check("b4", "<2 items>", "std::vector >") + + Check("b4.0", "[0]", "1", "bool") + + Check("b4.1", "[1]", "0", "bool"); QTest::newRow("StdVectorQt") << Data("#include \n" + fooData,