Changeset View
Changeset View
Standalone View
Standalone View
duchain/tests/uses.cpp
Show First 20 Lines • Show All 1215 Lines • ▼ Show 20 Line(s) | 1210 | { | |||
---|---|---|---|---|---|
1216 | DUChainWriteLocker lock(DUChain::lock()); | 1216 | DUChainWriteLocker lock(DUChain::lock()); | ||
1217 | 1217 | | |||
1218 | Declaration *a = top->localDeclarations().at(0); | 1218 | Declaration *a = top->localDeclarations().at(0); | ||
1219 | QCOMPARE(a->identifier().toString(), QString("a")); | 1219 | QCOMPARE(a->identifier().toString(), QString("a")); | ||
1220 | compareUses(a, QList<RangeInRevision>() << RangeInRevision(0, 17, 0, 19) | 1220 | compareUses(a, QList<RangeInRevision>() << RangeInRevision(0, 17, 0, 19) | ||
1221 | << RangeInRevision(0, 37, 0, 39)); | 1221 | << RangeInRevision(0, 37, 0, 39)); | ||
1222 | } | 1222 | } | ||
1223 | 1223 | | |||
1224 | void TestUses::returnTypeClassFunction() { | ||||
1225 | QByteArray method("<? class A { function foo(): A {} function bar(): self {} }"); | ||||
1226 | TopDUContext *top = parse(method, DumpNone); | ||||
1227 | DUChainReleaser releaseTop(top); | ||||
1228 | DUChainWriteLocker lock(DUChain::lock()); | ||||
1229 | | ||||
1230 | Declaration *a = top->localDeclarations().at(0); | ||||
1231 | QCOMPARE(a->identifier().toString(), QString("a")); | ||||
1232 | compareUses(a, QList<RangeInRevision>() << RangeInRevision(0, 29, 0, 30) << RangeInRevision(0, 50, 0, 54)); | ||||
1233 | } | ||||
1234 | | ||||
1235 | void TestUses::returnTypeFunction() { | ||||
1236 | QByteArray method("<? class A {} function foo(): A {}"); | ||||
1237 | TopDUContext *top = parse(method, DumpNone); | ||||
1238 | DUChainReleaser releaseTop(top); | ||||
1239 | DUChainWriteLocker lock(DUChain::lock()); | ||||
1240 | | ||||
1241 | Declaration *a = top->localDeclarations().at(0); | ||||
1242 | QCOMPARE(a->identifier().toString(), QString("a")); | ||||
1243 | compareUses(a, QList<RangeInRevision>() << RangeInRevision(0, 30, 0, 31)); | ||||
1244 | } | ||||
1245 | | ||||
1224 | } | 1246 | } | ||
1225 | 1247 | |