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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1113223006: Use IncrementalCompilationUnitElementBuilder in BuildCompilationUnitElementTask. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library test.src.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/element.dart'; 9 import 'package:analyzer/src/generated/element.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 part 'part.dart'; 198 part 'part.dart';
199 class A {} 199 class A {}
200 class B = Object with A; 200 class B = Object with A;
201 '''); 201 ''');
202 expect(outputs, hasLength(3)); 202 expect(outputs, hasLength(3));
203 expect(outputs[CLASS_ELEMENTS], hasLength(2)); 203 expect(outputs[CLASS_ELEMENTS], hasLength(2));
204 expect(outputs[COMPILATION_UNIT_ELEMENT], isNotNull); 204 expect(outputs[COMPILATION_UNIT_ELEMENT], isNotNull);
205 expect(outputs[RESOLVED_UNIT1], isNotNull); 205 expect(outputs[RESOLVED_UNIT1], isNotNull);
206 } 206 }
207 207
208 test_perform_useMemento() {
209 String content = r'''
210 library lib;
211 import 'lib2.dart';
212 export 'lib3.dart';
213 part 'part.dart';
214 class A {''';
215 Source source = newSource('/test.dart', content);
216 AnalysisTarget target = new LibrarySpecificUnit(source, source);
217 _computeResult(target, RESOLVED_UNIT1);
218 // update content
219 context.setContents(source, content);
220 assertIsInvalid(target, RESOLVED_UNIT1);
221 // recompute
222 _computeResult(target, RESOLVED_UNIT1);
223 assertIsValid(target, RESOLVED_UNIT1);
224 // values from the memento are returned
225 assertSameResults(ParseDartTask.DESCRIPTOR.results);
226 }
227
208 void _performBuildTask(String content) { 228 void _performBuildTask(String content) {
209 Source source = newSource('/test.dart', content); 229 Source source = newSource('/test.dart', content);
210 AnalysisTarget target = new LibrarySpecificUnit(source, source); 230 AnalysisTarget target = new LibrarySpecificUnit(source, source);
211 _computeResult(target, RESOLVED_UNIT1); 231 _computeResult(target, RESOLVED_UNIT1);
212 expect(task, new isInstanceOf<BuildCompilationUnitElementTask>()); 232 expect(task, new isInstanceOf<BuildCompilationUnitElementTask>());
213 } 233 }
214 } 234 }
215 235
216 @reflectiveTest 236 @reflectiveTest
217 class BuildDirectiveElementsTaskTest extends _AbstractDartTaskTest { 237 class BuildDirectiveElementsTaskTest extends _AbstractDartTaskTest {
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 /** 1926 /**
1907 * Fill [errorListener] with [result] errors in the current [task]. 1927 * Fill [errorListener] with [result] errors in the current [task].
1908 */ 1928 */
1909 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 1929 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
1910 List<AnalysisError> errors = task.outputs[result]; 1930 List<AnalysisError> errors = task.outputs[result];
1911 expect(errors, isNotNull, reason: result.name); 1931 expect(errors, isNotNull, reason: result.name);
1912 errorListener = new GatheringErrorListener(); 1932 errorListener = new GatheringErrorListener();
1913 errorListener.addAll(errors); 1933 errorListener.addAll(errors);
1914 } 1934 }
1915 } 1935 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698