forked from qt-creator/qt-creator
C++: unit test for code completion
Added unit test for code completion when pointer's type is a typedef Change-Id: I408be8d9364a4b48824238dcc44175167ae653f4 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
committed by
hjk
parent
45cd2d1e8f
commit
d08af15002
@@ -533,6 +533,34 @@ void CppToolsPlugin::test_completion_template_7()
|
||||
QVERIFY(completions.contains(QLatin1String("i")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion_type_of_pointer_is_typedef()
|
||||
{
|
||||
TestData data;
|
||||
data.srcText = "\n"
|
||||
"typedef struct Foo\n"
|
||||
"{\n"
|
||||
" int foo;\n"
|
||||
"} Foo;\n"
|
||||
"Foo *bar;\n"
|
||||
"@\n"
|
||||
;
|
||||
|
||||
setup(&data);
|
||||
|
||||
Utils::ChangeSet change;
|
||||
QString txt = QLatin1String("bar->");
|
||||
change.insert(data.pos, txt);
|
||||
QTextCursor cursor(data.doc);
|
||||
change.apply(&cursor);
|
||||
data.pos += txt.length();
|
||||
|
||||
QStringList completions = getCompletions(data);
|
||||
|
||||
QCOMPARE(completions.size(), 2);
|
||||
QVERIFY(completions.contains(QLatin1String("Foo")));
|
||||
QVERIFY(completions.contains(QLatin1String("foo")));
|
||||
}
|
||||
|
||||
void CppToolsPlugin::test_completion()
|
||||
{
|
||||
QFETCH(QByteArray, code);
|
||||
|
||||
@@ -100,6 +100,7 @@ private slots:
|
||||
void test_completion_template_5();
|
||||
void test_completion_template_6();
|
||||
void test_completion_template_7();
|
||||
void test_completion_type_of_pointer_is_typedef();
|
||||
void test_completion_template_as_base();
|
||||
void test_completion_template_as_base_data();
|
||||
void test_completion_use_global_identifier_as_base_class();
|
||||
|
||||
Reference in New Issue
Block a user