mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Set CacheEntry.target in the contructor.
R=brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org//1135613002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45619 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
47df8674d1
commit
194d48f9da
3 changed files with 98 additions and 75 deletions
|
@ -115,9 +115,10 @@ class AnalysisCache {
|
|||
}
|
||||
|
||||
/**
|
||||
* Associate the given [entry] with the given [target].
|
||||
* Puts the given [entry] into the cache.
|
||||
*/
|
||||
void put(AnalysisTarget target, CacheEntry entry) {
|
||||
void put(CacheEntry entry) {
|
||||
AnalysisTarget target = entry.target;
|
||||
entry.fixExceptionState();
|
||||
int count = _partitions.length;
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
@ -134,7 +135,7 @@ class AnalysisCache {
|
|||
// 'Diff = ${entry.getDiff(oldEntry)}');
|
||||
}
|
||||
}
|
||||
partition.put(target, entry);
|
||||
partition.put(entry);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -192,16 +193,16 @@ class CacheEntry {
|
|||
*/
|
||||
static int _EXPLICITLY_ADDED_FLAG = 0;
|
||||
|
||||
/**
|
||||
* The target this entry is about.
|
||||
*/
|
||||
final AnalysisTarget target;
|
||||
|
||||
/**
|
||||
* The partition that is responsible for this entry.
|
||||
*/
|
||||
CachePartition _partition;
|
||||
|
||||
/**
|
||||
* The target this entry is about.
|
||||
*/
|
||||
AnalysisTarget _target;
|
||||
|
||||
/**
|
||||
* The most recent time at which the state of the target matched the state
|
||||
* represented by this entry.
|
||||
|
@ -225,6 +226,8 @@ class CacheEntry {
|
|||
Map<ResultDescriptor, ResultData> _resultMap =
|
||||
new HashMap<ResultDescriptor, ResultData>();
|
||||
|
||||
CacheEntry(this.target);
|
||||
|
||||
/**
|
||||
* The exception that caused one or more values to have a state of
|
||||
* [CacheState.ERROR].
|
||||
|
@ -287,7 +290,7 @@ class CacheEntry {
|
|||
return descriptor.defaultValue;
|
||||
}
|
||||
if (_partition != null) {
|
||||
_partition.resultAccessed(_target, descriptor);
|
||||
_partition.resultAccessed(target, descriptor);
|
||||
}
|
||||
return data.value;
|
||||
}
|
||||
|
@ -383,7 +386,7 @@ class CacheEntry {
|
|||
/*<V>*/ void setValue(ResultDescriptor /*<V>*/ descriptor, dynamic /*V*/
|
||||
value, List<TargetedResult> dependedOn, Object memento) {
|
||||
_validateStateChange(descriptor, CacheState.VALID);
|
||||
TargetedResult thisResult = new TargetedResult(_target, descriptor);
|
||||
TargetedResult thisResult = new TargetedResult(target, descriptor);
|
||||
if (_partition != null) {
|
||||
_partition.resultStored(thisResult, value);
|
||||
}
|
||||
|
@ -430,7 +433,7 @@ class CacheEntry {
|
|||
}
|
||||
thisData.value = descriptor.defaultValue;
|
||||
// Stop depending on other results.
|
||||
TargetedResult thisResult = new TargetedResult(_target, descriptor);
|
||||
TargetedResult thisResult = new TargetedResult(target, descriptor);
|
||||
List<TargetedResult> dependedOnResults = thisData.dependedOnResults;
|
||||
thisData.dependedOnResults = <TargetedResult>[];
|
||||
dependedOnResults.forEach((TargetedResult dependedOnResult) {
|
||||
|
@ -692,15 +695,15 @@ abstract class CachePartition {
|
|||
new SingleMapIterator<AnalysisTarget, CacheEntry>(_targetMap);
|
||||
|
||||
/**
|
||||
* Associate the given [entry] with the given [target].
|
||||
* Puts the given [entry] into the partition.
|
||||
*/
|
||||
void put(AnalysisTarget target, CacheEntry entry) {
|
||||
void put(CacheEntry entry) {
|
||||
AnalysisTarget target = entry.target;
|
||||
if (entry._partition != null) {
|
||||
throw new StateError(
|
||||
'The entry for $target is already in ${entry._partition}');
|
||||
}
|
||||
entry._partition = this;
|
||||
entry._target = target;
|
||||
entry.fixExceptionState();
|
||||
_targetMap[target] = entry;
|
||||
}
|
||||
|
|
|
@ -678,8 +678,8 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
|||
cache.CacheEntry getCacheEntry(AnalysisTarget target) {
|
||||
cache.CacheEntry entry = _cache.get(target);
|
||||
if (entry == null) {
|
||||
entry = new cache.CacheEntry();
|
||||
_cache.put(target, entry);
|
||||
entry = new cache.CacheEntry(target);
|
||||
_cache.put(entry);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
@ -1407,10 +1407,10 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
|||
* entry that was created.
|
||||
*/
|
||||
cache.CacheEntry _createCacheEntry(Source source, bool explicitlyAdded) {
|
||||
cache.CacheEntry entry = new cache.CacheEntry();
|
||||
cache.CacheEntry entry = new cache.CacheEntry(source);
|
||||
entry.modificationTime = getModificationStamp(source);
|
||||
entry.explicitlyAdded = explicitlyAdded;
|
||||
_cache.put(source, entry);
|
||||
_cache.put(entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ class AnalysisCacheTest extends EngineTestCase {
|
|||
void test_iterator() {
|
||||
AnalysisCache cache = createCache();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
cache.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
cache.put(entry);
|
||||
MapIterator<AnalysisTarget, CacheEntry> iterator = cache.iterator();
|
||||
expect(iterator.moveNext(), isTrue);
|
||||
expect(iterator.key, same(target));
|
||||
|
@ -74,9 +74,9 @@ class AnalysisCacheTest extends EngineTestCase {
|
|||
void test_put() {
|
||||
AnalysisCache cache = createCache();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(cache.get(target), isNull);
|
||||
cache.put(target, entry);
|
||||
cache.put(entry);
|
||||
expect(cache.get(target), entry);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ class AnalysisCacheTest extends EngineTestCase {
|
|||
int size = 4;
|
||||
for (int i = 0; i < size; i++) {
|
||||
AnalysisTarget target = new TestSource("/test$i.dart");
|
||||
cache.put(target, new CacheEntry());
|
||||
cache.put(new CacheEntry(target));
|
||||
}
|
||||
expect(cache.size(), size);
|
||||
}
|
||||
|
@ -110,16 +110,18 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_explicitlyAdded() {
|
||||
CacheEntry entry = new CacheEntry();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(entry.explicitlyAdded, false);
|
||||
entry.explicitlyAdded = true;
|
||||
expect(entry.explicitlyAdded, true);
|
||||
}
|
||||
|
||||
test_fixExceptionState_error_exception() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CaughtException exception = new CaughtException(null, null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.setErrorState(exception, <ResultDescriptor>[result]);
|
||||
entry.fixExceptionState();
|
||||
expect(entry.getState(result), CacheState.ERROR);
|
||||
|
@ -127,8 +129,9 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_fixExceptionState_noError_exception() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
// set one result to ERROR
|
||||
CaughtException exception = new CaughtException(null, null);
|
||||
entry.setErrorState(exception, <ResultDescriptor>[result]);
|
||||
|
@ -140,30 +143,33 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_fixExceptionState_noError_noException() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.fixExceptionState();
|
||||
expect(entry.getState(result), CacheState.INVALID);
|
||||
expect(entry.exception, isNull);
|
||||
}
|
||||
|
||||
test_getMemento_noResult() {
|
||||
String defaultValue = 'value';
|
||||
ResultDescriptor result = new ResultDescriptor('test', defaultValue);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(entry.getMemento(result), null);
|
||||
}
|
||||
|
||||
test_getState() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(entry.getState(result), CacheState.INVALID);
|
||||
}
|
||||
|
||||
test_getValue() {
|
||||
test_getValue_default() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
String defaultValue = 'value';
|
||||
ResultDescriptor result = new ResultDescriptor('test', defaultValue);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(entry.getValue(result), defaultValue);
|
||||
}
|
||||
|
||||
|
@ -176,8 +182,8 @@ class CacheEntryTest extends EngineTestCase {
|
|||
ResultDescriptor descriptor3 =
|
||||
new ResultDescriptor('result3', null, cachingPolicy: cachingPolicy);
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
cache.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
cache.put(entry);
|
||||
{
|
||||
entry.setValue(descriptor1, 1, TargetedResult.EMPTY_LIST, null);
|
||||
expect(entry.getState(descriptor1), CacheState.VALID);
|
||||
|
@ -198,21 +204,24 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_hasErrorState_false() {
|
||||
CacheEntry entry = new CacheEntry();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(entry.hasErrorState(), false);
|
||||
}
|
||||
|
||||
test_hasErrorState_true() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CaughtException exception = new CaughtException(null, null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.setErrorState(exception, <ResultDescriptor>[result]);
|
||||
expect(entry.hasErrorState(), true);
|
||||
}
|
||||
|
||||
test_invalidateAllInformation() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.setValue(result, 'value', TargetedResult.EMPTY_LIST, null);
|
||||
entry.invalidateAllInformation();
|
||||
expect(entry.getState(result), CacheState.INVALID);
|
||||
|
@ -220,11 +229,12 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_setErrorState() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result1 = new ResultDescriptor('res1', 1);
|
||||
ResultDescriptor result2 = new ResultDescriptor('res2', 2);
|
||||
ResultDescriptor result3 = new ResultDescriptor('res3', 3);
|
||||
// prepare some good state
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.setValue(result1, 10, TargetedResult.EMPTY_LIST, null);
|
||||
entry.setValue(result2, 20, TargetedResult.EMPTY_LIST, null);
|
||||
entry.setValue(result3, 30, TargetedResult.EMPTY_LIST, null);
|
||||
|
@ -244,10 +254,10 @@ class CacheEntryTest extends EngineTestCase {
|
|||
test_setErrorState_invalidateDependent() {
|
||||
AnalysisTarget target1 = new TestSource('/a.dart');
|
||||
AnalysisTarget target2 = new TestSource('/b.dart');
|
||||
CacheEntry entry1 = new CacheEntry();
|
||||
CacheEntry entry2 = new CacheEntry();
|
||||
cache.put(target1, entry1);
|
||||
cache.put(target2, entry2);
|
||||
CacheEntry entry1 = new CacheEntry(target1);
|
||||
CacheEntry entry2 = new CacheEntry(target2);
|
||||
cache.put(entry1);
|
||||
cache.put(entry2);
|
||||
ResultDescriptor result1 = new ResultDescriptor('result1', -1);
|
||||
ResultDescriptor result2 = new ResultDescriptor('result2', -2);
|
||||
ResultDescriptor result3 = new ResultDescriptor('result3', -3);
|
||||
|
@ -282,32 +292,36 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_setErrorState_noDescriptors() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
CaughtException exception = new CaughtException(null, null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(() {
|
||||
entry.setErrorState(exception, <ResultDescriptor>[]);
|
||||
}, throwsArgumentError);
|
||||
}
|
||||
|
||||
test_setErrorState_noException() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(() {
|
||||
entry.setErrorState(null, <ResultDescriptor>[result]);
|
||||
}, throwsArgumentError);
|
||||
}
|
||||
|
||||
test_setErrorState_nullDescriptors() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
CaughtException exception = new CaughtException(null, null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(() {
|
||||
entry.setErrorState(exception, null);
|
||||
}, throwsArgumentError);
|
||||
}
|
||||
|
||||
test_setState_error() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.setValue(result, 42, TargetedResult.EMPTY_LIST, null);
|
||||
// an invalid state change
|
||||
expect(() {
|
||||
|
@ -319,8 +333,9 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_setState_flushed() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', 1);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
// set VALID
|
||||
entry.setValue(result, 10, TargetedResult.EMPTY_LIST, null);
|
||||
expect(entry.getState(result), CacheState.VALID);
|
||||
|
@ -332,8 +347,9 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_setState_inProcess() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', 1);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
// set VALID
|
||||
entry.setValue(result, 10, TargetedResult.EMPTY_LIST, null);
|
||||
expect(entry.getState(result), CacheState.VALID);
|
||||
|
@ -345,8 +361,9 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_setState_invalid() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', 1);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
// set VALID
|
||||
String memento = 'main() {}';
|
||||
entry.setValue(result, 10, TargetedResult.EMPTY_LIST, memento);
|
||||
|
@ -361,8 +378,8 @@ class CacheEntryTest extends EngineTestCase {
|
|||
|
||||
test_setState_invalid_invalidateDependent() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
cache.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
cache.put(entry);
|
||||
ResultDescriptor result1 = new ResultDescriptor('result1', -1);
|
||||
ResultDescriptor result2 = new ResultDescriptor('result2', -2);
|
||||
ResultDescriptor result3 = new ResultDescriptor('result3', -3);
|
||||
|
@ -393,16 +410,18 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_setState_valid() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(() => entry.setState(result, CacheState.VALID), throwsArgumentError);
|
||||
}
|
||||
|
||||
test_setValue() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
String value = 'value';
|
||||
String memento = 'main() {}';
|
||||
CacheEntry entry = new CacheEntry();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.setValue(result, value, TargetedResult.EMPTY_LIST, memento);
|
||||
expect(entry.getState(result), CacheState.VALID);
|
||||
expect(entry.getValue(result), value);
|
||||
|
@ -418,8 +437,8 @@ class CacheEntryTest extends EngineTestCase {
|
|||
ResultDescriptor descriptor3 =
|
||||
new ResultDescriptor('result3', null, cachingPolicy: cachingPolicy);
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
cache.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
cache.put(entry);
|
||||
Object memento1 = 'aaa';
|
||||
{
|
||||
entry.setValue(descriptor1, 1, TargetedResult.EMPTY_LIST, memento1);
|
||||
|
@ -442,8 +461,8 @@ class CacheEntryTest extends EngineTestCase {
|
|||
|
||||
test_setValue_invalidateDependent() {
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
cache.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
cache.put(entry);
|
||||
ResultDescriptor result1 = new ResultDescriptor('result1', -1);
|
||||
ResultDescriptor result2 = new ResultDescriptor('result2', -2);
|
||||
ResultDescriptor result3 = new ResultDescriptor('result3', -3);
|
||||
|
@ -476,10 +495,10 @@ class CacheEntryTest extends EngineTestCase {
|
|||
test_setValue_invalidateDependent2() {
|
||||
AnalysisTarget target1 = new TestSource('a');
|
||||
AnalysisTarget target2 = new TestSource('b');
|
||||
CacheEntry entry1 = new CacheEntry();
|
||||
CacheEntry entry2 = new CacheEntry();
|
||||
cache.put(target1, entry1);
|
||||
cache.put(target2, entry2);
|
||||
CacheEntry entry1 = new CacheEntry(target1);
|
||||
CacheEntry entry2 = new CacheEntry(target2);
|
||||
cache.put(entry1);
|
||||
cache.put(entry2);
|
||||
ResultDescriptor result1 = new ResultDescriptor('result1', -1);
|
||||
ResultDescriptor result2 = new ResultDescriptor('result2', -2);
|
||||
ResultDescriptor result3 = new ResultDescriptor('result3', -3);
|
||||
|
@ -504,15 +523,16 @@ class CacheEntryTest extends EngineTestCase {
|
|||
}
|
||||
|
||||
test_toString_empty() {
|
||||
CacheEntry entry = new CacheEntry();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
expect(entry.toString(), isNotNull);
|
||||
}
|
||||
|
||||
test_toString_nonEmpty() {
|
||||
String value = 'value';
|
||||
AnalysisTarget target = new TestSource();
|
||||
ResultDescriptor result = new ResultDescriptor('test', null);
|
||||
CacheEntry entry = new CacheEntry();
|
||||
entry.setValue(result, value, TargetedResult.EMPTY_LIST, null);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
entry.setValue(result, 42, TargetedResult.EMPTY_LIST, null);
|
||||
expect(entry.toString(), isNotNull);
|
||||
}
|
||||
}
|
||||
|
@ -668,8 +688,8 @@ abstract class CachePartitionTest extends EngineTestCase {
|
|||
void test_entrySet() {
|
||||
CachePartition partition = createPartition();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
partition.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
partition.put(entry);
|
||||
Map<AnalysisTarget, CacheEntry> entryMap = partition.map;
|
||||
expect(entryMap, hasLength(1));
|
||||
AnalysisTarget entryKey = entryMap.keys.first;
|
||||
|
@ -687,24 +707,24 @@ abstract class CachePartitionTest extends EngineTestCase {
|
|||
CachePartition partition1 = createPartition();
|
||||
CachePartition partition2 = createPartition();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
partition1.put(target, entry);
|
||||
expect(() => partition2.put(target, entry), throwsStateError);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
partition1.put(entry);
|
||||
expect(() => partition2.put(entry), throwsStateError);
|
||||
}
|
||||
|
||||
void test_put_noFlush() {
|
||||
CachePartition partition = createPartition();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
partition.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
partition.put(entry);
|
||||
expect(partition.get(target), entry);
|
||||
}
|
||||
|
||||
void test_remove() {
|
||||
CachePartition partition = createPartition();
|
||||
AnalysisTarget target = new TestSource();
|
||||
CacheEntry entry = new CacheEntry();
|
||||
partition.put(target, entry);
|
||||
CacheEntry entry = new CacheEntry(target);
|
||||
partition.put(entry);
|
||||
expect(partition.get(target), entry);
|
||||
partition.remove(target);
|
||||
expect(partition.get(target), isNull);
|
||||
|
|
Loading…
Reference in a new issue