diff options
author | Przemyslaw Gorszkowski <pgorszkowski@gmail.com> | 2013-04-04 12:07:44 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2013-04-10 14:52:20 +0200 |
commit | 9c2a352027711519fb7dcc579f520717cd7ed115 (patch) | |
tree | c3f51cf79fed49fe22e4ed7426b0f2fa5a0c8b84 /tests/auto/cplusplus/findusages/tst_findusages.cpp | |
parent | 7543a0858286ac9ae27a5cfb5ea4d3e237981283 (diff) | |
download | qt-creator-9c2a352027711519fb7dcc579f520717cd7ed115.tar.gz |
C++: fixed operator arrow of nested class of enclosing template
Fixed:
* code completion
* highlighting
* find usage
* follow symbol
Task-number: QTCREATORBUG-9005
Change-Id: I3fcc2638482ca1071c1aa7b6aab0d4dd128595bb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'tests/auto/cplusplus/findusages/tst_findusages.cpp')
-rw-r--r-- | tests/auto/cplusplus/findusages/tst_findusages.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/cplusplus/findusages/tst_findusages.cpp b/tests/auto/cplusplus/findusages/tst_findusages.cpp index f2098ab838..c193c9639f 100644 --- a/tests/auto/cplusplus/findusages/tst_findusages.cpp +++ b/tests/auto/cplusplus/findusages/tst_findusages.cpp @@ -95,6 +95,7 @@ private Q_SLOTS: // templates void instantiateTemplateWithNestedClass(); void operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG9006(); + void operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005(); }; void tst_FindUsages::inlineMethod() @@ -490,5 +491,49 @@ void tst_FindUsages::operatorAsteriskOfNestedClassOfTemplateClass_QTCREATORBUG90 QCOMPARE(findUsages.usages().size(), 2); } +void tst_FindUsages::operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005() +{ + const QByteArray src = "\n" + "struct Foo { int foo; };\n" + "\n" + "template<class T>\n" + "struct Outer\n" + "{\n" + " struct Nested\n" + " {\n" + " T *operator->() { return 0; }\n" + " };\n" + "};\n" + "\n" + "void bug()\n" + "{\n" + " Outer<Foo>::Nested nested;\n" + " nested->foo;\n" + "}\n" + ; + + Document::Ptr doc = Document::create("operatorArrowOfNestedClassOfTemplateClass_QTCREATORBUG9005"); + doc->setUtf8Source(src); + doc->parse(); + doc->check(); + + QVERIFY(doc->diagnosticMessages().isEmpty()); + QCOMPARE(doc->globalSymbolCount(), 3U); + + Snapshot snapshot; + snapshot.insert(doc); + + Class *classFoo = doc->globalSymbolAt(0)->asClass(); + QVERIFY(classFoo); + QCOMPARE(classFoo->memberCount(), 1U); + Declaration *fooDeclaration = classFoo->memberAt(0)->asDeclaration(); + QVERIFY(fooDeclaration); + QCOMPARE(fooDeclaration->name()->identifier()->chars(), "foo"); + + FindUsages findUsages(src, doc, snapshot); + findUsages(fooDeclaration); + QCOMPARE(findUsages.usages().size(), 2); +} + QTEST_APPLESS_MAIN(tst_FindUsages) #include "tst_findusages.moc" |