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

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

Issue 1141953002: Always send errors/lines with parsed/resolved units. (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_work_manager.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_work_manager_test; 5 library test.src.task.dart_work_manager_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/engine.dart' 9 import 'package:analyzer/src/generated/engine.dart'
10 show 10 show
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 354 }
355 355
356 void test_resultsComputed_notDart() { 356 void test_resultsComputed_notDart() {
357 manager.unknownSourceQueue.addAll([source1, source2]); 357 manager.unknownSourceQueue.addAll([source1, source2]);
358 manager.resultsComputed(new TestSource('test.html'), {}); 358 manager.resultsComputed(new TestSource('test.html'), {});
359 expect_librarySourceQueue([]); 359 expect_librarySourceQueue([]);
360 expect_unknownSourceQueue([source1, source2]); 360 expect_unknownSourceQueue([source1, source2]);
361 } 361 }
362 362
363 void test_resultsComputed_parsedUnit() { 363 void test_resultsComputed_parsedUnit() {
364 when(context.getLibrariesContaining(source1)).thenReturn([]);
365 LineInfo lineInfo = new LineInfo([0]);
366 entry1.setValue(LINE_INFO, lineInfo, []);
364 CompilationUnit unit = AstFactory.compilationUnit(); 367 CompilationUnit unit = AstFactory.compilationUnit();
365 manager.resultsComputed(source1, {PARSED_UNIT: unit}); 368 manager.resultsComputed(source1, {PARSED_UNIT: unit});
366 ChangeNoticeImpl notice = context.getNotice(source1); 369 ChangeNoticeImpl notice = context.getNotice(source1);
367 expect(notice.parsedDartUnit, unit); 370 expect(notice.parsedDartUnit, unit);
368 expect(notice.resolvedDartUnit, isNull); 371 expect(notice.resolvedDartUnit, isNull);
372 expect(notice.lineInfo, lineInfo);
369 } 373 }
370 374
371 void test_resultsComputed_resolvedUnit() { 375 void test_resultsComputed_resolvedUnit() {
376 when(context.getLibrariesContaining(source2)).thenReturn([]);
377 LineInfo lineInfo = new LineInfo([0]);
378 entry2.setValue(LINE_INFO, lineInfo, []);
372 CompilationUnit unit = AstFactory.compilationUnit(); 379 CompilationUnit unit = AstFactory.compilationUnit();
373 manager.resultsComputed( 380 manager.resultsComputed(
374 new LibrarySpecificUnit(source1, source2), {RESOLVED_UNIT: unit}); 381 new LibrarySpecificUnit(source1, source2), {RESOLVED_UNIT: unit});
375 ChangeNoticeImpl notice = context.getNotice(source2); 382 ChangeNoticeImpl notice = context.getNotice(source2);
376 expect(notice.parsedDartUnit, isNull); 383 expect(notice.parsedDartUnit, isNull);
377 expect(notice.resolvedDartUnit, unit); 384 expect(notice.resolvedDartUnit, unit);
385 expect(notice.lineInfo, lineInfo);
378 } 386 }
379 387
380 void test_resultsComputed_sourceKind_isLibrary() { 388 void test_resultsComputed_sourceKind_isLibrary() {
381 manager.unknownSourceQueue.addAll([source1, source2, source3]); 389 manager.unknownSourceQueue.addAll([source1, source2, source3]);
382 manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.LIBRARY}); 390 manager.resultsComputed(source2, {SOURCE_KIND: SourceKind.LIBRARY});
383 expect_librarySourceQueue([source2]); 391 expect_librarySourceQueue([source2]);
384 expect_unknownSourceQueue([source1, source3]); 392 expect_unknownSourceQueue([source1, source3]);
385 } 393 }
386 394
387 void test_resultsComputed_sourceKind_isPart() { 395 void test_resultsComputed_sourceKind_isPart() {
(...skipping 26 matching lines...) Expand all
414 } 422 }
415 423
416 @override 424 @override
417 ChangeNoticeImpl getNotice(Source source) { 425 ChangeNoticeImpl getNotice(Source source) {
418 return _pendingNotices.putIfAbsent( 426 return _pendingNotices.putIfAbsent(
419 source, () => new ChangeNoticeImpl(source)); 427 source, () => new ChangeNoticeImpl(source));
420 } 428 }
421 429
422 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 430 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
423 } 431 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart_work_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698