| 378 | #endif |
| 379 | |
| 380 | void TestDUChain::testDefinitions() |
| 381 | { |
| 382 | DUChainReadLocker lock; |
| 383 | auto* const definitions = DUChain::definitions(); |
| 384 | const DeclarationId id(QualifiedIdentifier{u"foo"}); |
| 385 | |
| 386 | QByteArray output; |
| 387 | const QTextStream stream(&output); |
| 388 | |
| 389 | QCOMPARE(definitions->definitions(id), {}); |
| 390 | definitions->dump(stream); |
| 391 | QCOMPARE(output, {}); |
| 392 | |
| 393 | const IndexedDeclaration indexed; |
| 394 | definitions->addDefinition(id, indexed); |
| 395 | |
| 396 | QCOMPARE(definitions->definitions(id), {indexed}); |
| 397 | definitions->dump(stream); |
| 398 | QCOMPARE(output, "Definitions for \"foo\" \n"); |
| 399 | output.clear(); |
| 400 | |
| 401 | definitions->removeDefinition(id, indexed); |
| 402 | |
| 403 | QCOMPARE(definitions->definitions(id), {}); |
| 404 | definitions->dump(stream); |
| 405 | QCOMPARE(output, {}); |
| 406 | } |
| 407 | |
| 408 | void TestDUChain::testSymbolTableValid() |
| 409 | { |
nothing calls this directly
no test coverage detected