| 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.options_work_manager_test; | 5 library test.src.task.options_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/engine.dart' | 8 import 'package:analyzer/src/generated/engine.dart' |
| 9 show | 9 show |
| 10 AnalysisEngine, | 10 AnalysisEngine, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 TargetedResult request = manager.getNextResult(); | 129 TargetedResult request = manager.getNextResult(); |
| 130 expect(request.target, source2); | 130 expect(request.target, source2); |
| 131 expect(request.result, ANALYSIS_OPTIONS_ERRORS); | 131 expect(request.result, ANALYSIS_OPTIONS_ERRORS); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void test_getErrors() { | 134 void test_getErrors() { |
| 135 AnalysisError error1 = new AnalysisError( | 135 AnalysisError error1 = new AnalysisError( |
| 136 source1, 1, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); | 136 source1, 1, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); |
| 137 AnalysisError error2 = new AnalysisError( | 137 AnalysisError error2 = new AnalysisError( |
| 138 source1, 2, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); | 138 source1, 2, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); |
| 139 entry1.setValue( | 139 entry1 |
| 140 ANALYSIS_OPTIONS_ERRORS, <AnalysisError>[error1, error2], []); | 140 .setValue(ANALYSIS_OPTIONS_ERRORS, <AnalysisError>[error1, error2], []); |
| 141 | 141 |
| 142 List<AnalysisError> errors = manager.getErrors(source1); | 142 List<AnalysisError> errors = manager.getErrors(source1); |
| 143 expect(errors, unorderedEquals([error1, error2])); | 143 expect(errors, unorderedEquals([error1, error2])); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void test_getNextResult_hasNormal_firstIsError() { | 146 void test_getNextResult_hasNormal_firstIsError() { |
| 147 entry1.setErrorState(caughtException, [ANALYSIS_OPTIONS_ERRORS]); | 147 entry1.setErrorState(caughtException, [ANALYSIS_OPTIONS_ERRORS]); |
| 148 manager.sourceQueue.addAll([source1, source2]); | 148 manager.sourceQueue.addAll([source1, source2]); |
| 149 TargetedResult request = manager.getNextResult(); | 149 TargetedResult request = manager.getNextResult(); |
| 150 expect(request.target, source2); | 150 expect(request.target, source2); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 expect(manager.getNextResultPriority(), WorkOrderPriority.NONE); | 226 expect(manager.getNextResultPriority(), WorkOrderPriority.NONE); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void test_resultsComputed_errors() { | 229 void test_resultsComputed_errors() { |
| 230 AnalysisError error1 = new AnalysisError( | 230 AnalysisError error1 = new AnalysisError( |
| 231 source1, 1, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); | 231 source1, 1, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); |
| 232 AnalysisError error2 = new AnalysisError( | 232 AnalysisError error2 = new AnalysisError( |
| 233 source1, 2, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); | 233 source1, 2, 0, AnalysisOptionsErrorCode.PARSE_ERROR, ['']); |
| 234 LineInfo lineInfo = new LineInfo([0]); | 234 LineInfo lineInfo = new LineInfo([0]); |
| 235 entry1.setValue(LINE_INFO, lineInfo, []); | 235 entry1.setValue(LINE_INFO, lineInfo, []); |
| 236 entry1.setValue( | 236 entry1 |
| 237 ANALYSIS_OPTIONS_ERRORS, <AnalysisError>[error1, error2], []); | 237 .setValue(ANALYSIS_OPTIONS_ERRORS, <AnalysisError>[error1, error2], []); |
| 238 // RESOLVED_UNIT is ready, set errors | 238 // RESOLVED_UNIT is ready, set errors |
| 239 manager.resultsComputed(source1, {ANALYSIS_OPTIONS_ERRORS: null}); | 239 manager.resultsComputed(source1, {ANALYSIS_OPTIONS_ERRORS: null}); |
| 240 // all of the errors are included | 240 // all of the errors are included |
| 241 ChangeNoticeImpl notice = context.getNotice(source1); | 241 ChangeNoticeImpl notice = context.getNotice(source1); |
| 242 expect(notice.errors, unorderedEquals([error1, error2])); | 242 expect(notice.errors, unorderedEquals([error1, error2])); |
| 243 expect(notice.lineInfo, lineInfo); | 243 expect(notice.lineInfo, lineInfo); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 class _InternalAnalysisContextMock extends TypedMock | 247 class _InternalAnalysisContextMock extends TypedMock |
| (...skipping 27 matching lines...) Expand all Loading... |
| 275 if (AnalysisEngine.isAnalysisOptionsFileName(source.shortName)) { | 275 if (AnalysisEngine.isAnalysisOptionsFileName(source.shortName)) { |
| 276 errors = getCacheEntry(source).getValue(ANALYSIS_OPTIONS_ERRORS); | 276 errors = getCacheEntry(source).getValue(ANALYSIS_OPTIONS_ERRORS); |
| 277 } | 277 } |
| 278 return new AnalysisErrorInfoImpl( | 278 return new AnalysisErrorInfoImpl( |
| 279 errors, getCacheEntry(source).getValue(LINE_INFO)); | 279 errors, getCacheEntry(source).getValue(LINE_INFO)); |
| 280 } | 280 } |
| 281 | 281 |
| 282 @override | 282 @override |
| 283 ChangeNoticeImpl getNotice(Source source) => | 283 ChangeNoticeImpl getNotice(Source source) => |
| 284 _pendingNotices.putIfAbsent(source, () => new ChangeNoticeImpl(source)); | 284 _pendingNotices.putIfAbsent(source, () => new ChangeNoticeImpl(source)); |
| 285 | |
| 286 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | |
| 287 } | 285 } |
| OLD | NEW |