forked from qt-creator/qt-creator
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 commits01f26bd5b7("Fix std::vector<bool> printer with custom allocator") and5eba3bde93("Fix std::basic_string printer with custom allocator"). Change-Id: I4de9de551d329b7d2ea821d09b04d39da13f1edf Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user