Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
ee16a1e8
Commit
ee16a1e8
authored
Feb 10, 2010
by
Erik Verbruggen
Browse files
Added testcase for find usages of inline method parameters.
parent
4df9b375
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/auto/cplusplus/findusages/tst_findusages.cpp
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 {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment