Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flatpak-qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marco Bubke
flatpak-qt-creator
Commits
ee16a1e8
Commit
ee16a1e8
authored
15 years ago
by
Erik Verbruggen
Browse files
Options
Downloads
Patches
Plain Diff
Added testcase for find usages of inline method parameters.
parent
4df9b375
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/auto/cplusplus/findusages/tst_findusages.cpp
+38
-0
38 additions, 0 deletions
tests/auto/cplusplus/findusages/tst_findusages.cpp
with
38 additions
and
0 deletions
tests/auto/cplusplus/findusages/tst_findusages.cpp
+
38
−
0
View file @
ee16a1e8
...
...
@@ -48,6 +48,8 @@ class tst_FindUsages: public QObject
Q_OBJECT
private
Q_SLOTS
:
void
inlineMethod
();
// Objective-C
void
objc_args
();
// void objc_methods();
...
...
@@ -55,6 +57,42 @@ private Q_SLOTS:
// void objc_classes();
};
void
tst_FindUsages
::
inlineMethod
()
{
const
QByteArray
src
=
"
\n
"
"class Tst {
\n
"
" int method(int arg) {
\n
"
" return arg;
\n
"
" }
\n
"
"};
\n
"
;
Document
::
Ptr
doc
=
Document
::
create
(
"inlineMethod"
);
doc
->
setSource
(
src
);
doc
->
parse
();
doc
->
check
();
QVERIFY
(
doc
->
diagnosticMessages
().
isEmpty
());
QCOMPARE
(
doc
->
globalSymbolCount
(),
1U
);
Snapshot
snapshot
;
snapshot
.
insert
(
doc
);
Class
*
tst
=
doc
->
globalSymbolAt
(
0
)
->
asClass
();
QVERIFY
(
tst
);
QCOMPARE
(
tst
->
memberCount
(),
1U
);
Function
*
method
=
tst
->
memberAt
(
0
)
->
asFunction
();
QVERIFY
(
method
);
QCOMPARE
(
method
->
argumentCount
(),
1U
);
Argument
*
arg
=
method
->
argumentAt
(
0
)
->
asArgument
();
QVERIFY
(
arg
);
QCOMPARE
(
arg
->
identifier
()
->
chars
(),
"arg"
);
FindUsages
findUsages
(
doc
,
snapshot
);
findUsages
.
setGlobalNamespaceBinding
(
bind
(
doc
,
snapshot
));
findUsages
(
arg
);
QCOMPARE
(
findUsages
.
usages
().
size
(),
2
);
QCOMPARE
(
findUsages
.
references
().
size
(),
2
);
}
#if 0
@interface Clazz {} +(void)method:(int)arg; @end
@implementation Clazz +(void)method:(int)arg {
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment