Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: pkg/analyzer/test/src/summary/incremental_cache_test.dart

Issue 2044513003: Serve INCLUDED_PARTS from incremental cache. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:analyzer/dart/element/element.dart'; 5 import 'package:analyzer/dart/element/element.dart';
6 import 'package:analyzer/src/generated/error.dart'; 6 import 'package:analyzer/src/generated/error.dart';
7 import 'package:analyzer/src/generated/source.dart'; 7 import 'package:analyzer/src/generated/source.dart';
8 import 'package:analyzer/src/summary/incremental_cache.dart'; 8 import 'package:analyzer/src/summary/incremental_cache.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 void test_getLibraryClosureBundles_onlyLibrary() { 114 void test_getLibraryClosureBundles_onlyLibrary() {
115 putTestLibrary(r''' 115 putTestLibrary(r'''
116 main() {} 116 main() {}
117 '''); 117 ''');
118 // the cache is empty, no bundles 118 // the cache is empty, no bundles
119 List<LibraryBundleWithId> bundles = 119 List<LibraryBundleWithId> bundles =
120 cache.getLibraryClosureBundles(testSource); 120 cache.getLibraryClosureBundles(testSource);
121 expect(bundles, isNotNull); 121 expect(bundles, isNotNull);
122 } 122 }
123 123
124 void test_getLibraryParts_hasParts() {
125 Source part1Source = addSource('/part1.dart', r'part of test;');
126 Source part2Source = addSource('/part2.dart', r'part of test;');
127 putTestLibrary(r'''
128 library test;
129 part 'part1.dart';
130 part 'part2.dart';
131 ''');
132 expect(cache.getLibraryParts(testSource),
133 unorderedEquals([part1Source, part2Source]));
134 }
135
136 void test_getLibraryParts_noParts() {
137 putTestLibrary(r'''
138 main() {}
139 ''');
140 expect(cache.getLibraryParts(testSource), isEmpty);
141 }
142
124 void test_getSourceErrorsInLibrary_library() { 143 void test_getSourceErrorsInLibrary_library() {
125 verifyNoTestUnitErrors = false; 144 verifyNoTestUnitErrors = false;
126 putTestLibrary(r''' 145 putTestLibrary(r'''
127 main() { 146 main() {
128 int unusedVar = 42; 147 int unusedVar = 42;
129 } 148 }
130 '''); 149 ''');
131 List<AnalysisError> computedErrors = context.computeErrors(testSource); 150 List<AnalysisError> computedErrors = context.computeErrors(testSource);
132 cache.putSourceErrorsInLibrary(testSource, testSource, computedErrors); 151 cache.putSourceErrorsInLibrary(testSource, testSource, computedErrors);
133 List<AnalysisError> readErrors = 152 List<AnalysisError> readErrors =
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 @override 237 @override
219 List<int> get(String key) { 238 List<int> get(String key) {
220 return map[key]; 239 return map[key];
221 } 240 }
222 241
223 @override 242 @override
224 void put(String key, List<int> bytes) { 243 void put(String key, List<int> bytes) {
225 map[key] = bytes; 244 map[key] = bytes;
226 } 245 }
227 } 246 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/incremental_cache.dart ('k') | pkg/analyzer_cli/lib/src/incremental_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698