summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletion_test.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-03-04 10:59:19 +0200
committerOrgad Shaneh <orgads@gmail.com>2015-03-05 06:23:31 +0000
commit93f57a99a1e9df7e427c346ef78fd1955ee89669 (patch)
treef8c8bad53368781078d39b3c3db684307e067687 /src/plugins/cpptools/cppcompletion_test.cpp
parent0b996210f6e0b7d98e505dd313fdc1ed69de3217 (diff)
downloadqt-creator-93f57a99a1e9df7e427c346ef78fd1955ee89669.tar.gz
C++: Fix nested type resolving in member functions
Task-number: QTCREATORBUG-13976 Task-number: QTCREATORBUG-13978 Change-Id: I598f9cb99ffd044abfc6ed9aa16d4a3045985008 Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletion_test.cpp')
-rw-r--r--src/plugins/cpptools/cppcompletion_test.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cppcompletion_test.cpp b/src/plugins/cpptools/cppcompletion_test.cpp
index fe82a7a196..f2eebca867 100644
--- a/src/plugins/cpptools/cppcompletion_test.cpp
+++ b/src/plugins/cpptools/cppcompletion_test.cpp
@@ -1482,7 +1482,7 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("A")
<< QLatin1String("a"));
- QTest::newRow("nested_class_declaration_with_object_name_inside_function") << _(
+ QTest::newRow("nested_named_class_declaration_inside_function") << _(
"int foo()\n"
"{\n"
" struct Nested\n"
@@ -1495,6 +1495,39 @@ void CppToolsPlugin::test_completion_data()
<< QLatin1String("Nested")
<< QLatin1String("i"));
+ QTest::newRow("nested_class_inside_member_function") << _(
+ "struct User { void use(); };\n"
+ "void User::use()\n"
+ "{\n"
+ " struct Foo { int bar; };\n"
+ " Foo foo;\n"
+ " @\n"
+ "}\n"
+ ) << _("foo.") << (QStringList()
+ << QLatin1String("Foo")
+ << QLatin1String("bar"));
+
+ QTest::newRow("nested_typedef_inside_member_function") << _(
+ "struct User { void use(); };\n"
+ "template<class T>\n"
+ "struct Pointer { T *operator->(); };\n"
+ "struct Foo\n"
+ "{\n"
+ " typedef Pointer<Foo> Ptr;\n"
+ " int bar;\n"
+ "};\n"
+ "\n"
+ "void User::use()\n"
+ "{\n"
+ " typedef Foo MyFoo;\n"
+ " MyFoo::Ptr myfoo;\n"
+ " @\n"
+ "}\n"
+ ) << _("myfoo->") << (QStringList()
+ << QLatin1String("Foo")
+ << QLatin1String("Ptr")
+ << QLatin1String("bar"));
+
QTest::newRow("nested_anonymous_class_QTCREATORBUG10876_1") << _(
"struct EnclosingStruct\n"
"{\n"