OLD | NEW |
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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 LineInfo lineInfo = new LineInfo([0]); | 300 LineInfo lineInfo = new LineInfo([0]); |
301 entry1.setValue(LINE_INFO, lineInfo, []); | 301 entry1.setValue(LINE_INFO, lineInfo, []); |
302 entry1.setValue(SCAN_ERRORS, <AnalysisError>[error1], []); | 302 entry1.setValue(SCAN_ERRORS, <AnalysisError>[error1], []); |
303 context.getCacheEntry(new LibrarySpecificUnit(source2, source1)).setValue( | 303 context.getCacheEntry(new LibrarySpecificUnit(source2, source1)).setValue( |
304 VERIFY_ERRORS, <AnalysisError>[error2], []); | 304 VERIFY_ERRORS, <AnalysisError>[error2], []); |
305 AnalysisErrorInfo errorInfo = manager.getErrors(source1); | 305 AnalysisErrorInfo errorInfo = manager.getErrors(source1); |
306 expect(errorInfo.errors, unorderedEquals([error1, error2])); | 306 expect(errorInfo.errors, unorderedEquals([error1, error2])); |
307 expect(errorInfo.lineInfo, lineInfo); | 307 expect(errorInfo.lineInfo, lineInfo); |
308 } | 308 } |
309 | 309 |
| 310 void test_getErrors_hasFullList() { |
| 311 AnalysisError error1 = |
| 312 new AnalysisError(source1, 1, 0, ScannerErrorCode.MISSING_DIGIT); |
| 313 AnalysisError error2 = |
| 314 new AnalysisError(source1, 2, 0, ScannerErrorCode.MISSING_DIGIT); |
| 315 when(context.getLibrariesContaining(source1)).thenReturn([source2]); |
| 316 LineInfo lineInfo = new LineInfo([0]); |
| 317 entry1.setValue(LINE_INFO, lineInfo, []); |
| 318 entry1.setValue(DART_ERRORS, <AnalysisError>[error1, error2], []); |
| 319 AnalysisErrorInfo errorInfo = manager.getErrors(source1); |
| 320 expect(errorInfo.errors, unorderedEquals([error1, error2])); |
| 321 expect(errorInfo.lineInfo, lineInfo); |
| 322 } |
| 323 |
310 void test_getLibrariesContainingPart() { | 324 void test_getLibrariesContainingPart() { |
311 Source part1 = new TestSource('part1.dart'); | 325 Source part1 = new TestSource('part1.dart'); |
312 Source part2 = new TestSource('part2.dart'); | 326 Source part2 = new TestSource('part2.dart'); |
313 Source part3 = new TestSource('part3.dart'); | 327 Source part3 = new TestSource('part3.dart'); |
314 Source library1 = new TestSource('library1.dart'); | 328 Source library1 = new TestSource('library1.dart'); |
315 Source library2 = new TestSource('library2.dart'); | 329 Source library2 = new TestSource('library2.dart'); |
316 manager.partLibrariesMap[part1] = [library1, library2]; | 330 manager.partLibrariesMap[part1] = [library1, library2]; |
317 manager.partLibrariesMap[part2] = [library2]; | 331 manager.partLibrariesMap[part2] = [library2]; |
318 manager.libraryPartsMap[library1] = [part1]; | 332 manager.libraryPartsMap[library1] = [part1]; |
319 manager.libraryPartsMap[library2] = [part1, part2]; | 333 manager.libraryPartsMap[library2] = [part1, part2]; |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 } | 690 } |
677 | 691 |
678 @override | 692 @override |
679 ChangeNoticeImpl getNotice(Source source) { | 693 ChangeNoticeImpl getNotice(Source source) { |
680 return _pendingNotices.putIfAbsent( | 694 return _pendingNotices.putIfAbsent( |
681 source, () => new ChangeNoticeImpl(source)); | 695 source, () => new ChangeNoticeImpl(source)); |
682 } | 696 } |
683 | 697 |
684 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 698 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
685 } | 699 } |
OLD | NEW |