Chromium Code Reviews| Index: pkg/analyzer/test/src/context/cache_test.dart |
| diff --git a/pkg/analyzer/test/src/context/cache_test.dart b/pkg/analyzer/test/src/context/cache_test.dart |
| index f093931059f89867317e21c65fa702964fde4f8b..94ae434c211328a01ce3da9489f6ca994692cbba 100644 |
| --- a/pkg/analyzer/test/src/context/cache_test.dart |
| +++ b/pkg/analyzer/test/src/context/cache_test.dart |
| @@ -183,6 +183,29 @@ class AnalysisCacheTest extends AbstractCacheTest { |
| } |
| expect(cache.size(), size); |
| } |
| + |
| + void test_sources() { |
| + AnalysisTarget source1 = new TestSource('1.dart'); |
| + AnalysisTarget source2 = new TestSource('2.dart'); |
| + AnalysisTarget target1 = new _TestAnalysisTarget(); |
| + // no entries |
| + expect(cache.sources, isEmpty); |
| + // add source1 |
| + cache.put(new CacheEntry(source1)); |
| + expect(cache.sources, unorderedEquals([source1])); |
| + // add target1 |
| + cache.put(new CacheEntry(target1)); |
| + expect(cache.sources, unorderedEquals([source1])); |
| + // add source2 |
| + cache.put(new CacheEntry(source2)); |
| + expect(cache.sources, unorderedEquals([source1, source2])); |
| + // remove source1 |
| + cache.remove(source1); |
| + expect(cache.sources, unorderedEquals([source2])); |
| + // remove source2 |
| + cache.remove(source2); |
| + expect(cache.sources, isEmpty); |
| + } |
| } |
| @reflectiveTest |
| @@ -842,3 +865,8 @@ class _InternalAnalysisContextMock extends TypedMock |
| implements InternalAnalysisContext { |
| noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| } |
| + |
| +class _TestAnalysisTarget implements AnalysisTarget { |
|
Brian Wilkerson
2015/05/21 13:52:31
Don't we already have this class somewhere?
|
| + @override |
| + Source get source => null; |
| +} |