NikicNodeExtractorCacheTest
class NikicNodeExtractorCacheTest extends TestCase (View source)
Covers the shared AST cache in NikicNodeExtractor.
AllStubsParser hands each stub file to every registered parser in turn, and each parser owns its own extractor, so every file used to be lexed and parsed once per parser — measured at 6 parses per file. The cache is therefore shared across instances rather than held per instance, which is what these tests pin down: correctness must not depend on which instance does the parsing, and a content change must not be served stale.
Constants
| private CLASS_SOURCE |
|
Methods
No description
No description
No description
Different extract* methods read different node kinds out of the same parse. Sharing one AST between them must not let one kind's traversal hide another's.
The cache holds a single entry, so alternating between two sources must re-parse rather than return the other one's nodes.
Keyed by content, not by identity: an equal string built separately must hit, and a changed string must miss.
No description
Imports come from the same parse as the nodes, so they must survive caching too.
Details
protected void
setUp()
No description
protected void
tearDown()
No description
void
testSecondInstanceSeesTheSameContentIdentically()
No description
void
testDifferentExtractorsReadTheSameCachedAst()
Different extract* methods read different node kinds out of the same parse. Sharing one AST between them must not let one kind's traversal hide another's.
void
testAlternatingBetweenTwoSourcesNeverReturnsStaleNodes()
The cache holds a single entry, so alternating between two sources must re-parse rather than return the other one's nodes.
void
testCacheIsKeyedByContentNotIdentity()
Keyed by content, not by identity: an equal string built separately must hit, and a changed string must miss.
void
testClearAstCacheDoesNotChangeResults()
No description
void
testImportsAreStillResolvedFromACachedParse()
Imports come from the same parse as the nodes, so they must survive caching too.