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

void
setUp()

No description

void
tearDown()

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
testImportsAreStillResolvedFromACachedParse()

Imports come from the same parse as the nodes, so they must survive caching too.

Details

protected void setUp()

No description

Return Value

void

protected void tearDown()

No description

Return Value

void

void testSecondInstanceSeesTheSameContentIdentically()

No description

Return Value

void

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.

Return Value

void

void testAlternatingBetweenTwoSourcesNeverReturnsStaleNodes()

The cache holds a single entry, so alternating between two sources must re-parse rather than return the other one's nodes.

Return Value

void

void testCacheIsKeyedByContentNotIdentity()

Keyed by content, not by identity: an equal string built separately must hit, and a changed string must miss.

Return Value

void

void testClearAstCacheDoesNotChangeResults()

No description

Return Value

void

void testImportsAreStillResolvedFromACachedParse()

Imports come from the same parse as the nodes, so they must survive caching too.

Return Value

void