forked from qt-creator/qt-creator
Unit tests for code completion
Unit tests for code completion for nested class when enclosing is a template Change-Id: I409f742923468db23dd9a8e4c18cbb21b1e52dd9 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
committed by
hjk
parent
978960904c
commit
b03ba2bdb1
@@ -812,7 +812,6 @@ void CppToolsPlugin::test_completion_base_class_has_name_the_same_as_derived_dat
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CppToolsPlugin::test_completion_cyclic_inheritance()
|
||||
{
|
||||
test_completion();
|
||||
@@ -970,3 +969,48 @@ void CppToolsPlugin::test_completion_cyclic_inheritance_data()
|
||||
<< code << completions;
|
||||
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_enclosing_template_class()
|
||||
{
|
||||
test_completion();
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_enclosing_template_class_data()
|
||||
{
|
||||
QTest::addColumn<QByteArray>("code");
|
||||
QTest::addColumn<QStringList>("expectedCompletions");
|
||||
|
||||
QByteArray code;
|
||||
QStringList completions;
|
||||
|
||||
code = "\n"
|
||||
"template<typename T>\n"
|
||||
"struct Enclosing\n"
|
||||
"{\n"
|
||||
" struct Nested { int int_nested; }; \n"
|
||||
" int int_enclosing;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"Enclosing<int>::Nested c;"
|
||||
"@\n";
|
||||
completions.append("Nested");
|
||||
completions.append("int_nested");
|
||||
QTest::newRow("case: nested class with enclosing template class")
|
||||
<< code << completions;
|
||||
|
||||
completions.clear();
|
||||
|
||||
code = "\n"
|
||||
"template<typename T>\n"
|
||||
"struct Enclosing\n"
|
||||
"{\n"
|
||||
" template<typename T> struct Nested { int int_nested; }; \n"
|
||||
" int int_enclosing;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"Enclosing<int>::Nested<int> c;"
|
||||
"@\n";
|
||||
completions.append("Nested");
|
||||
completions.append("int_nested");
|
||||
QTest::newRow("case: nested template class with enclosing template class")
|
||||
<< code << completions;}
|
||||
|
||||
@@ -104,6 +104,8 @@ private slots:
|
||||
void test_completion_base_class_has_name_the_same_as_derived_data();
|
||||
void test_completion_cyclic_inheritance();
|
||||
void test_completion_cyclic_inheritance_data();
|
||||
void test_completion_enclosing_template_class();
|
||||
void test_completion_enclosing_template_class_data();
|
||||
|
||||
private:
|
||||
void test_completion();
|
||||
|
||||
Reference in New Issue
Block a user