diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-01-12 22:05:41 +0100 |
---|---|---|
committer | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-01-30 18:49:25 +0100 |
commit | ffba28d26ab6aaf9a953f42d5fa15c55a85c75a7 (patch) | |
tree | 010c0eb03d5caf768b3206ee7b69fe68b93a333c /src/plugins/cpptools/cppcompletion_test.cpp | |
parent | 0135609973b8c8f9b380aefb618659f698c5c2c5 (diff) | |
download | qt-creator-ffba28d26ab6aaf9a953f42d5fa15c55a85c75a7.tar.gz |
C++: Fix code compl. for instantiation of template specialization
It works for full specialization. Instantiate of the partial
specialization has to be implemented(finding appropriate partial
specialization-on going)
Added unit test.
Change-Id: I8ef5ea963e7c665e0d67d390b3a833486773dab0
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcompletion_test.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp index 80471cd8df..63325d521f 100644 --- a/src/plugins/cpptools/cppcompletion_test.cpp +++ b/src/plugins/cpptools/cppcompletion_test.cpp @@ -564,6 +564,42 @@ void CppToolsPlugin::test_completion_type_of_pointer_is_typedef() QVERIFY(completions.contains(QLatin1String("foo"))); } +void CppToolsPlugin::test_completion_instantiate_full_specialization() +{ + TestData data; + data.srcText = "\n" + "template<typename T>\n" + "struct Template\n" + "{\n" + " int templateT_i;\n" + "};\n" + "\n" + "template<>\n" + "struct Template<char>\n" + "{\n" + " int templateChar_i;\n" + "};\n" + "\n" + "Template<char> templateChar;\n" + "@\n" + ; + + setup(&data); + + Utils::ChangeSet change; + QString txt = QLatin1String("templateChar."); + 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("Template"))); + QVERIFY(completions.contains(QLatin1String("templateChar_i"))); +} + void CppToolsPlugin::test_completion() { QFETCH(QByteArray, code); |