Commit b0c3a6ba authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

CppTools: Generalize data-driven test_completion



Change-Id: I409a00b869a95dff2d69c9744da75c324c82776a
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 0204f566
...@@ -52,6 +52,9 @@ using namespace CppTools::Internal; ...@@ -52,6 +52,9 @@ using namespace CppTools::Internal;
using namespace TextEditor; using namespace TextEditor;
using namespace Core; using namespace Core;
namespace {
typedef QByteArray _;
class CompletionTestCase class CompletionTestCase
{ {
public: public:
...@@ -152,6 +155,8 @@ private: ...@@ -152,6 +155,8 @@ private:
CppModelManager *cmm; CppModelManager *cmm;
}; };
} // namespace
void CppToolsPlugin::test_completion_forward_declarations_present() void CppToolsPlugin::test_completion_forward_declarations_present()
{ {
const QByteArray source = const QByteArray source =
...@@ -499,9 +504,10 @@ void CppToolsPlugin::test_completion_instantiate_full_specialization() ...@@ -499,9 +504,10 @@ void CppToolsPlugin::test_completion_instantiate_full_specialization()
void CppToolsPlugin::test_completion() void CppToolsPlugin::test_completion()
{ {
QFETCH(QByteArray, code); QFETCH(QByteArray, code);
QFETCH(QByteArray, prefix);
QFETCH(QStringList, expectedCompletions); QFETCH(QStringList, expectedCompletions);
CompletionTestCase test(code, "c."); CompletionTestCase test(code, prefix);
QStringList actualCompletions = test.getCompletions(); QStringList actualCompletions = test.getCompletions();
actualCompletions.sort(); actualCompletions.sort();
...@@ -518,6 +524,7 @@ void CppToolsPlugin::test_completion_template_as_base() ...@@ -518,6 +524,7 @@ void CppToolsPlugin::test_completion_template_as_base()
void CppToolsPlugin::test_completion_template_as_base_data() void CppToolsPlugin::test_completion_template_as_base_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -535,7 +542,7 @@ void CppToolsPlugin::test_completion_template_as_base_data() ...@@ -535,7 +542,7 @@ void CppToolsPlugin::test_completion_template_as_base_data()
completions.append(QLatin1String("dataMember")); completions.append(QLatin1String("dataMember"));
completions.append(QLatin1String("Other")); completions.append(QLatin1String("Other"));
completions.append(QLatin1String("otherMember")); completions.append(QLatin1String("otherMember"));
QTest::newRow("case: base as template directly") << code << completions; QTest::newRow("case: base as template directly") << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -553,7 +560,7 @@ void CppToolsPlugin::test_completion_template_as_base_data() ...@@ -553,7 +560,7 @@ void CppToolsPlugin::test_completion_template_as_base_data()
completions.append(QLatin1String("otherMember")); completions.append(QLatin1String("otherMember"));
completions.append(QLatin1String("More")); completions.append(QLatin1String("More"));
completions.append(QLatin1String("moreMember")); completions.append(QLatin1String("moreMember"));
QTest::newRow("case: base as class template") << code << completions; QTest::newRow("case: base as class template") << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -571,7 +578,8 @@ void CppToolsPlugin::test_completion_template_as_base_data() ...@@ -571,7 +578,8 @@ void CppToolsPlugin::test_completion_template_as_base_data()
completions.append(QLatin1String("otherMember")); completions.append(QLatin1String("otherMember"));
completions.append(QLatin1String("More")); completions.append(QLatin1String("More"));
completions.append(QLatin1String("moreMember")); completions.append(QLatin1String("moreMember"));
QTest::newRow("case: base as globally qualified class template") << code << completions; QTest::newRow("case: base as globally qualified class template")
<< code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -591,7 +599,8 @@ void CppToolsPlugin::test_completion_template_as_base_data() ...@@ -591,7 +599,8 @@ void CppToolsPlugin::test_completion_template_as_base_data()
completions.append(QLatin1String("otherMember")); completions.append(QLatin1String("otherMember"));
completions.append(QLatin1String("More")); completions.append(QLatin1String("More"));
completions.append(QLatin1String("moreMember")); completions.append(QLatin1String("moreMember"));
QTest::newRow("case: base as namespace qualified class template") << code << completions; QTest::newRow("case: base as namespace qualified class template")
<< code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -609,7 +618,7 @@ void CppToolsPlugin::test_completion_template_as_base_data() ...@@ -609,7 +618,7 @@ void CppToolsPlugin::test_completion_template_as_base_data()
completions.append(QLatin1String("dataMember")); completions.append(QLatin1String("dataMember"));
completions.append(QLatin1String("Final")); completions.append(QLatin1String("Final"));
completions.append(QLatin1String("finalMember")); completions.append(QLatin1String("finalMember"));
QTest::newRow("case: base as nested template name") << code << completions; QTest::newRow("case: base as nested template name") << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -627,7 +636,8 @@ void CppToolsPlugin::test_completion_template_as_base_data() ...@@ -627,7 +636,8 @@ void CppToolsPlugin::test_completion_template_as_base_data()
completions.append(QLatin1String("dataMember")); completions.append(QLatin1String("dataMember"));
completions.append(QLatin1String("Final")); completions.append(QLatin1String("Final"));
completions.append(QLatin1String("finalMember")); completions.append(QLatin1String("finalMember"));
QTest::newRow("case: base as nested template name in non-template") << code << completions; QTest::newRow("case: base as nested template name in non-template")
<< code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -647,7 +657,7 @@ void CppToolsPlugin::test_completion_template_as_base_data() ...@@ -647,7 +657,7 @@ void CppToolsPlugin::test_completion_template_as_base_data()
completions.append(QLatin1String("finalMember")); completions.append(QLatin1String("finalMember"));
completions.append(QLatin1String("Other")); completions.append(QLatin1String("Other"));
completions.append(QLatin1String("otherMember")); completions.append(QLatin1String("otherMember"));
QTest::newRow("case: base as template name in non-template") << code << completions; QTest::newRow("case: base as template name in non-template") << code << _("c.") << completions;
} }
void CppToolsPlugin::test_completion_use_global_identifier_as_base_class() void CppToolsPlugin::test_completion_use_global_identifier_as_base_class()
...@@ -658,6 +668,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class() ...@@ -658,6 +668,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class()
void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data() void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -681,7 +692,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data() ...@@ -681,7 +692,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data()
completions.append(QLatin1String("int_final")); completions.append(QLatin1String("int_final"));
completions.append(QLatin1String("Final")); completions.append(QLatin1String("Final"));
completions.append(QLatin1String("Global")); completions.append(QLatin1String("Global"));
QTest::newRow("case: derived as global and base as global") << code << completions; QTest::newRow("case: derived as global and base as global") << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -707,7 +718,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data() ...@@ -707,7 +718,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data()
completions.append(QLatin1String("Final")); completions.append(QLatin1String("Final"));
completions.append(QLatin1String("Global")); completions.append(QLatin1String("Global"));
QTest::newRow("case: derived is inside namespace, base as global") QTest::newRow("case: derived is inside namespace, base as global")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -735,7 +746,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data() ...@@ -735,7 +746,7 @@ void CppToolsPlugin::test_completion_use_global_identifier_as_base_class_data()
// completions.append(QLatin1String("Final")); // completions.append(QLatin1String("Final"));
// completions.append(QLatin1String("Global")); // completions.append(QLatin1String("Global"));
// QTest::newRow("case: derived is enclosed by template, base as global") // QTest::newRow("case: derived is enclosed by template, base as global")
// << code << completions; // << code << _("c.") << completions;
// completions.clear(); // completions.clear();
} }
...@@ -748,6 +759,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived() ...@@ -748,6 +759,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived()
void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_data() void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -764,7 +776,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat ...@@ -764,7 +776,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
completions.append(QLatin1String("int_a")); completions.append(QLatin1String("int_a"));
completions.append(QLatin1String("A")); completions.append(QLatin1String("A"));
QTest::newRow("case: base class is derived class") << code << completions; QTest::newRow("case: base class is derived class") << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -783,7 +795,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat ...@@ -783,7 +795,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
completions.append(QLatin1String("int_a")); completions.append(QLatin1String("int_a"));
completions.append(QLatin1String("A")); completions.append(QLatin1String("A"));
QTest::newRow("case: base class is derived class. class is in namespace") QTest::newRow("case: base class is derived class. class is in namespace")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -802,7 +814,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat ...@@ -802,7 +814,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
completions.append(QLatin1String("int_a")); completions.append(QLatin1String("int_a"));
completions.append(QLatin1String("A")); completions.append(QLatin1String("A"));
QTest::newRow("case: base class is derived class. class is in namespace. " QTest::newRow("case: base class is derived class. class is in namespace. "
"use scope operator for base class") << code << completions; "use scope operator for base class") << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -829,7 +841,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat ...@@ -829,7 +841,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
completions.append(QLatin1String("int_ns2_a")); completions.append(QLatin1String("int_ns2_a"));
completions.append(QLatin1String("A")); completions.append(QLatin1String("A"));
QTest::newRow("case: base class has the same name as derived but in different namespace") QTest::newRow("case: base class has the same name as derived but in different namespace")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -856,7 +868,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat ...@@ -856,7 +868,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
completions.append(QLatin1String("int_ns2_a")); completions.append(QLatin1String("int_ns2_a"));
completions.append(QLatin1String("A")); completions.append(QLatin1String("A"));
QTest::newRow("case: base class has the same name as derived(in namespace) " QTest::newRow("case: base class has the same name as derived(in namespace) "
"but is nested by different class") << code << completions; "but is nested by different class") << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -883,7 +895,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat ...@@ -883,7 +895,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
completions.append(QLatin1String("int_enclosing_derived_a")); completions.append(QLatin1String("int_enclosing_derived_a"));
completions.append(QLatin1String("A")); completions.append(QLatin1String("A"));
QTest::newRow("case: base class has the same name as derived(nested) " QTest::newRow("case: base class has the same name as derived(nested) "
"but is nested by different class") << code << completions; "but is nested by different class") << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -900,7 +912,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat ...@@ -900,7 +912,7 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
completions.append(QLatin1String("int_a")); completions.append(QLatin1String("int_a"));
completions.append(QLatin1String("A")); completions.append(QLatin1String("A"));
QTest::newRow("case: base class is derived class. class is a template") QTest::newRow("case: base class is derived class. class is a template")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
} }
...@@ -913,6 +925,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance() ...@@ -913,6 +925,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance()
void CppToolsPlugin::test_completion_cyclic_inheritance_data() void CppToolsPlugin::test_completion_cyclic_inheritance_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -930,7 +943,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data() ...@@ -930,7 +943,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
completions.append(QLatin1String("_a")); completions.append(QLatin1String("_a"));
completions.append(QLatin1String("B")); completions.append(QLatin1String("B"));
completions.append(QLatin1String("_b")); completions.append(QLatin1String("_b"));
QTest::newRow("case: direct cyclic inheritance") << code << completions; QTest::newRow("case: direct cyclic inheritance") << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -948,7 +961,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data() ...@@ -948,7 +961,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
completions.append(QLatin1String("_b")); completions.append(QLatin1String("_b"));
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("_c")); completions.append(QLatin1String("_c"));
QTest::newRow("case: indirect cyclic inheritance") << code << completions; QTest::newRow("case: indirect cyclic inheritance") << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -966,7 +979,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data() ...@@ -966,7 +979,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
completions.append(QLatin1String("_b")); completions.append(QLatin1String("_b"));
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("_c")); completions.append(QLatin1String("_c"));
QTest::newRow("case: indirect cyclic inheritance") << code << completions; QTest::newRow("case: indirect cyclic inheritance") << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -990,7 +1003,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data() ...@@ -990,7 +1003,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("_c_t")); completions.append(QLatin1String("_c_t"));
QTest::newRow("case: direct cyclic inheritance with templates") QTest::newRow("case: direct cyclic inheritance with templates")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -1020,7 +1033,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data() ...@@ -1020,7 +1033,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
completions.append(QLatin1String("B")); completions.append(QLatin1String("B"));
completions.append(QLatin1String("_b_t")); completions.append(QLatin1String("_b_t"));
QTest::newRow("case: indirect cyclic inheritance with templates") QTest::newRow("case: indirect cyclic inheritance with templates")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
code = code =
...@@ -1058,7 +1071,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data() ...@@ -1058,7 +1071,7 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
completions.append(QLatin1String("class_recurse_s")); completions.append(QLatin1String("class_recurse_s"));
completions.append(QLatin1String("class_recurse_t")); completions.append(QLatin1String("class_recurse_t"));
QTest::newRow("case: direct cyclic inheritance with templates, more complex situation") QTest::newRow("case: direct cyclic inheritance with templates, more complex situation")
<< code << completions; << code << _("c.") << completions;
} }
void CppToolsPlugin::test_completion_template_function() void CppToolsPlugin::test_completion_template_function()
...@@ -1125,6 +1138,7 @@ void CppToolsPlugin::test_completion_enclosing_template_class() ...@@ -1125,6 +1138,7 @@ void CppToolsPlugin::test_completion_enclosing_template_class()
void CppToolsPlugin::test_completion_enclosing_template_class_data() void CppToolsPlugin::test_completion_enclosing_template_class_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -1143,7 +1157,7 @@ void CppToolsPlugin::test_completion_enclosing_template_class_data() ...@@ -1143,7 +1157,7 @@ void CppToolsPlugin::test_completion_enclosing_template_class_data()
completions.append(QLatin1String("Nested")); completions.append(QLatin1String("Nested"));
completions.append(QLatin1String("int_nested")); completions.append(QLatin1String("int_nested"));
QTest::newRow("case: nested class with enclosing template class") QTest::newRow("case: nested class with enclosing template class")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -1160,7 +1174,7 @@ void CppToolsPlugin::test_completion_enclosing_template_class_data() ...@@ -1160,7 +1174,7 @@ void CppToolsPlugin::test_completion_enclosing_template_class_data()
completions.append(QLatin1String("Nested")); completions.append(QLatin1String("Nested"));
completions.append(QLatin1String("int_nested")); completions.append(QLatin1String("int_nested"));
QTest::newRow("case: nested template class with enclosing template class") QTest::newRow("case: nested template class with enclosing template class")
<< code << completions; << code << _("c.") << completions;
} }
void CppToolsPlugin::test_completion_instantiate_nested_class_when_enclosing_is_template() void CppToolsPlugin::test_completion_instantiate_nested_class_when_enclosing_is_template()
...@@ -1719,6 +1733,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration() ...@@ -1719,6 +1733,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration()
void CppToolsPlugin::test_completion_type_and_using_declaration_data() void CppToolsPlugin::test_completion_type_and_using_declaration_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -1738,7 +1753,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data() ...@@ -1738,7 +1753,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data()
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: type and using declaration inside function") QTest::newRow("case: type and using declaration inside function")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -1756,7 +1771,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data() ...@@ -1756,7 +1771,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data()
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: type and using declaration in global namespace") QTest::newRow("case: type and using declaration in global namespace")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -1774,7 +1789,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data() ...@@ -1774,7 +1789,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data()
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: type in global namespace and using declaration in NS namespace") QTest::newRow("case: type in global namespace and using declaration in NS namespace")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -1792,7 +1807,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data() ...@@ -1792,7 +1807,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data()
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: type in global namespace and using declaration inside function in NS namespace") QTest::newRow("case: type in global namespace and using declaration inside function in NS namespace")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -1813,7 +1828,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data() ...@@ -1813,7 +1828,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data()
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: type inside namespace NS1 and using declaration in function inside NS2 namespace") QTest::newRow("case: type inside namespace NS1 and using declaration in function inside NS2 namespace")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -1834,7 +1849,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data() ...@@ -1834,7 +1849,7 @@ void CppToolsPlugin::test_completion_type_and_using_declaration_data()
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: type inside namespace NS1 and using declaration inside NS2 namespace") QTest::newRow("case: type inside namespace NS1 and using declaration inside NS2 namespace")
<< code << completions; << code << _("c.") << completions;
} }
void CppToolsPlugin::test_completion_instantiate_template_with_anonymous_class() void CppToolsPlugin::test_completion_instantiate_template_with_anonymous_class()
...@@ -2126,6 +2141,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_ ...@@ -2126,6 +2141,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_
void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_QTCREATORBUG3620_data() void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_QTCREATORBUG3620_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -2141,7 +2157,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_ ...@@ -2141,7 +2157,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: class definition inside function") QTest::newRow("case: class definition inside function")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -2158,7 +2174,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_ ...@@ -2158,7 +2174,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m")); completions.append(QLatin1String("m"));
QTest::newRow("case: class definition inside block inside function") QTest::newRow("case: class definition inside block inside function")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
...@@ -2178,7 +2194,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_ ...@@ -2178,7 +2194,7 @@ void CppToolsPlugin::test_completion_class_declaration_inside_function_or_block_
completions.append(QLatin1String("C")); completions.append(QLatin1String("C"));
completions.append(QLatin1String("m2")); completions.append(QLatin1String("m2"));
QTest::newRow("case: class definition with the same name inside different block inside function") QTest::newRow("case: class definition with the same name inside different block inside function")
<< code << completions; << code << _("c.") << completions;
completions.clear(); completions.clear();
} }
...@@ -2191,6 +2207,7 @@ void CppToolsPlugin::test_completion_namespace_alias_inside_function_or_block_QT ...@@ -2191,6 +2207,7 @@ void CppToolsPlugin::test_completion_namespace_alias_inside_function_or_block_QT
void CppToolsPlugin::test_completion_namespace_alias_inside_function_or_block_QTCREATORBUG166_data() void CppToolsPlugin::test_completion_namespace_alias_inside_function_or_block_QTCREATORBUG166_data()
{ {
QTest::addColumn<QByteArray>("code"); QTest::addColumn<QByteArray>("code");
QTest::addColumn<QByteArray>("prefix");
QTest::addColumn<QStringList>("expectedCompletions"); QTest::addColumn<QStringList>("expectedCompletions");
QByteArray code; QByteArray code;
...@@ -2216,7 +2233,7 @@ void CppToolsPlugin::test_completion_namespace_alias_inside_function_or_block_QT ...@@ -2216,7 +2233,7 @@ void CppToolsPlugin::test_completion_namespace_alias_inside_function_or_block_QT
completions.append(QLatin1String("C"