diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2019-06-26 13:48:15 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2019-07-01 14:50:16 +0000 |
commit | cf7fa03866b88e36ace93fabad3428905066ce4c (patch) | |
tree | 0f064c4db05d0d1b7a5e2df49ddbbdfc7449a97f /tests/auto | |
parent | 42d331a90c1fa51f953b066acd7e7cfbf44d1044 (diff) |
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<bool> printer with custom allocator")
and 5eba3bde9369fa084f2fe4d935f302ea2061db83
("Fix std::basic_string printer with custom allocator").
Change-Id: I4de9de551d329b7d2ea821d09b04d39da13f1edf
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 3b59a9cce8..c912f726aa 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 <string>\n" + "template<class T>\n" + "class myallocator : public std::allocator<T> {};\n", + "std::basic_string<char, std::char_traits<char>, myallocator<char>> str(\"hello\");\n" + "unused(&str);\n") + + Check("str", "\"hello\"", "std::basic_string<char, std::char_traits<char>, myallocator<char> >") + + Check("str.0", "[0]", "104", "char") // 104: ASCII 'h' + + Check("str.1", "[1]", "101", "char"); // 101: ASCII 'e' + + QTest::newRow("StdString") << Data("#include <string>\n", "std::string str0, str;\n" @@ -4925,7 +4936,9 @@ void tst_Dumpers::dumper_data() QTest::newRow("StdVector") << Data("#include <vector>\n" - "#include <list>\n", + "#include <list>\n" + "template<class T>\n" + "class myallocator : public std::allocator<T> {};\n", "std::vector<double> v0, v1;\n" "v1.push_back(1);\n" @@ -4970,7 +4983,12 @@ void tst_Dumpers::dumper_data() "unused(&b2);\n\n" "std::vector<bool> b3(300);\n" - "unused(&b3);\n") + "unused(&b3);\n" + + "std::vector<bool, myallocator<bool>> b4;\n" + "b4.push_back(true);\n" + "b4.push_back(false);\n" + "unused(&b4);\n") + Check("v0", "<0 items>", "std::vector<double>") + Check("v1", "<3 items>", "std::vector<double>") @@ -5010,8 +5028,11 @@ void tst_Dumpers::dumper_data() + Check("b3", "<300 items>", "std::vector<bool>") + Check("b3.0", "[0]", "0", "bool") - + Check("b3.299", "[299]", "0", "bool"); + + Check("b3.299", "[299]", "0", "bool") + + Check("b4", "<2 items>", "std::vector<bool, myallocator<bool> >") + + Check("b4.0", "[0]", "1", "bool") + + Check("b4.1", "[1]", "0", "bool"); QTest::newRow("StdVectorQt") << Data("#include <vector>\n" + fooData, |